I have a TextView
. How can I position it by using x and y coordinates?
TextView leftArrow = new TextView(this);
leftArrow.setTypeface(tf);
leftArrow.setTex开发者_如何学Ct("<");
leftArrow.setTextSize(30);
ll.addView(leftArrow);
you can use view.setX() and view.setY() ,see the following link
http://developer.android.com/reference/android/view/View.html#setX(float)
If you really, really want x,y positioning, use the deprecated AbsoluteLayout -- but read Alternative to AbsoluteLayout in Android? before (it's no good for different screen sizes).
You'll likely fare much better with RelativeLayout depending on your problem.
精彩评论