Friday, 22 July 2011

Android: aligning views in parent ViewGroup instance

It seems LinearLayout doesn't do anything with 'layout_alignParentRight' etc parameters though it does compile/build ok with these specified. So if you want to align a View within its parent ViewGroup instance, use RelativeLayout instead.

The downside of using RelativeLayout is that for each child View you have to remember to specify which other child View it is relative to and how (e.g. layout_toLeftOf, 'layout_below' etc ).

No comments: