Question

Alternative to AbsoluteLayout in Android?

If AbsoluteLayout is deprecated what can I use instead of it?

I've done an app that uses AbsoluteLayout but it doesn't work well with the different screen resolutions. I use because I can set the X and Y position of a button. Can I set the position of a button using another layout?

 45  56063  45
1 Jan 1970

Solution

 12

Use RelativeLayout and set left and right margins like

RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
lp.leftMargin = x;
lp.topMargin =  y;
2013-01-23