当一个ListView的item为一个RelativeLayout时,该ViewGroup下的子view如果配置为 android:layout_alignParentBottom="true",本来是让子view靠近RelativeLayout的底部,但实际运行结果却是靠到顶部。
[img]http://dl.iteye.com/upload/attachment/378692/2a9b5fde-c750-35a1-843b-7add64bdc39f.jpg[/img]
据说这是个BUG,关于这个BUG的进一步描述可以在这里看到:[url=http://code.google.com/p/android/issues/detail?id=1394]Issue 1394[/url]
在[url=http://kevinlynx.iteye.com/blog/855282]昨天关于QuickContactBadge嵌入ListView item的例子[/url]中,就可以发现这个问题。上面那个网页也有人给出了解决方案。
[color=red]
即:
1、指定RelativeLayout的具体高度,例如:[/color]
[code]
android:layout_height="?android:attr/listPreferredItemHeight"
[/code]
[color=red]
2、ListView中实例化layout时,使用如下代码:[/color]
[code]
convertView = mInflater.inflate(mResource, parent, false);
[/code]
基于以上,即可让android:layout_alignParentBottom="true"表现正确。
[img]http://dl.iteye.com/upload/attachment/378694/470edf6b-5c8a-33f1-85ec-ec9c410089e4.jpg[/img]
[img]http://dl.iteye.com/upload/attachment/378692/2a9b5fde-c750-35a1-843b-7add64bdc39f.jpg[/img]
据说这是个BUG,关于这个BUG的进一步描述可以在这里看到:[url=http://code.google.com/p/android/issues/detail?id=1394]Issue 1394[/url]
在[url=http://kevinlynx.iteye.com/blog/855282]昨天关于QuickContactBadge嵌入ListView item的例子[/url]中,就可以发现这个问题。上面那个网页也有人给出了解决方案。
[color=red]
即:
1、指定RelativeLayout的具体高度,例如:[/color]
[code]
android:layout_height="?android:attr/listPreferredItemHeight"
[/code]
[color=red]
2、ListView中实例化layout时,使用如下代码:[/color]
[code]
convertView = mInflater.inflate(mResource, parent, false);
[/code]
基于以上,即可让android:layout_alignParentBottom="true"表现正确。
[img]http://dl.iteye.com/upload/attachment/378694/470edf6b-5c8a-33f1-85ec-ec9c410089e4.jpg[/img]