android:layout_alignParentBottom在ListView中没有显式布局高度的情况下使用时被忽略 [英] android:layout_alignParentBottom is ignored when used without explicit layout height as a row in ListView

查看:101
本文介绍了android:layout_alignParentBottom在ListView中没有显式布局高度的情况下使用时被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用RelativeLayout并将fill_parentwrap_content作为高度,并指定一个元素:android:layout_alignParentBottom="true"时,它将被忽略,并在顶部对齐.将RelativeLayout的高度设置为显式值可以使其起作用.有任何线索吗?

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?

推荐答案

这似乎是Android本身的错误,请参见

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

我通过将RelativeLayout包裹在FrameLayout中并将底部对齐的视图作为FrameLayout的子级和android:layout_gravity="bottom"来解决此问题.这会阻止您从RelativeLayout内部引用它,因此您必须解决该问题(例如,使用边距).

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.

这篇关于android:layout_alignParentBottom在ListView中没有显式布局高度的情况下使用时被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆