List of usage examples for android.widget TextView setX
public void setX(float x)
From source file:com.jaspersoft.android.jaspermobile.widget.DraggableViewsContainer.java
private int addDraggableNote(float x, float y) { int viewId = getChildCount(); TextView textView = new TextView(getContext()); textView.setTextColor(mColor);// w w w .j av a 2 s. co m textView.setTextSize(10 + mSize * 2); textView.setX(x); textView.setY(y); textView.setId(viewId); textView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showTextInputDialog(v.getId(), ((TextView) v).getText().toString()); } }); textView.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { ClipData data = ClipData.newPlainText(String.valueOf(v.getId()), ""); View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(v); v.startDrag(data, shadowBuilder, null, 0); return true; } }); addView(textView); return viewId; }
From source file:de.tobiasbielefeld.solitaire.games.Game.java
/** * mirrors the textViews, if there are any. Used for left handed mode */// www .j av a2 s . co m public void mirrorTextViews(RelativeLayout layoutGame) { for (TextView textView : textViews) { textView.setX(layoutGame.getWidth() - textView.getX() - Card.width); } }
From source file:com.example.SmartBoard.DrawingView.java
public Bitmap textToBitmap(String text, int color, float posX, float posY, int size) { TextView textView = new TextView(getContext()); textView.setVisibility(View.VISIBLE); textView.setTextColor(color);//from w w w . j a v a2 s.c om textView.setMaxWidth(500); textView.setMaxHeight(500); textView.setMaxLines(4); textView.setX(posX); textView.setY(posY); textView.setText(text); textView.setTextSize(size); LinearLayout layout = new LinearLayout(getContext()); layout.addView(textView); layout.measure(500, 500); layout.layout(0, 0, 500, 500); textView.setDrawingCacheEnabled(true); textView.buildDrawingCache(); Bitmap bm = textView.getDrawingCache(); return bm; }