alexanderblom alexanderblom - 5 months ago 16
Android Question

android:layout_alignParentBottom is ignored when used without explicit layout height as a row in ListView

When I use a

RelativeLayout
with either
fill_parent
or
wrap_content
as height and an element which specifies:
android:layout_alignParentBottom="true"
it is ignored and it is aligned at the top. Setting the height of the
RelativeLayout
to an explicit value makes it work. Any clues?

Answer

This seems to be a bug in Android itself, see http://code.google.com/p/android/issues/detail?id=1394.

I worked around it by wrapping my RelativeLayout in a FrameLayout and putting my bottom aligned view as a children of the FrameLayout with android:layout_gravity="bottom". This hinders you from referencing it from within the RelativeLayout so you'll have to work around that (for example using margins).

If anyone has a better workaround, please share.

Comments