我正在尝试使用百分比相对布局 into 列表显示,但它不起作用,
高度和宽度百分比被忽略,列表视图中没有显示任何内容。
它只适用于棉花糖.
这是列表项 xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:background="#d20404"
android:id="@+id/test_image_id"
android:layout_width="match_parent"
android:layout_height="300dp" />
<TextView
android:background="#000"
android:text="sfgfashdsfg"
android:layout_below="@+id/test_image_id"
app:layout_heightPercent="50%"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.percent.PercentRelativeLayout>
我有一个示例项目github https://github.com/developer--/PercentRelativeLayoutDemo
我已经向谷歌打开了这个问题。答案是
ListView 行项目的高度指定不充分。
第一个孩子说它想要占据行高的 60%(请注意
这是heightPercent,而不是aspectRatio),第二个孩子说
它想要占据行高的 10%。但没有任何东西告诉 ListView 如何
整排人都想长高。所以它最终的高度为 0。
请注意,height=match_parent 的语义在 ListView 中不起作用
行,以及这是否适用于任何一个特定的 Android 平台版本
(无论你怎么说它有效),这纯粹是偶然的。
https://code.google.com/p/android/issues/detail?id=202479 https://code.google.com/p/android/issues/detail?id=202479
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)