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

前端 未结 4 1594
灰色年华
灰色年华 2021-02-13 15:40

When I use a RelativeLayout with either fill_parent or wrap_content as height and an element which specifies: android:layout_alignPa

4条回答
  •  轮回少年
    2021-02-13 16:25

    I was able to get the proper alignment by specifying the problematic TextView with:

    android:id="@+id/must_be_bottom_left"
    android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true"
    android:layout_below="@id/xxx"
    

    where xxx was the id of a TextView that has android:layout_below="@id/yyy"

    and yyy is a TextView that is always above both xxx and must_be_bottom_left.

    The contents of my list items can vary so that sometimes the "xxx" TextView is View.GONE, but even then the layout works as expected.

    I don't know how fragile or merely seredipidous this work-around is. I am using Android 1.6 and I haven't tested it for forward compatability.

提交回复
热议问题