【发布时间】:2012-02-24 23:14:36
【问题描述】:
这应该是一件很容易的事情,但看起来很棘手。 在我的代码中,我有这个 ListView:
<ListView android:id="@+id/sums_list" android:layout_width="fill_parent"
android:layout_height="0dp" android:layout_weight="1" android:dividerHeight="0dp"></ListView>
其中填充了一个使用此视图的 ArrayAdapter:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cdpb="http://schemas.android.com/apk/res/ale.android.brainfitness"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="55dp">
...
</LinearLayout>
为什么项目 55dp 不高?
谢谢大家
【问题讨论】:
-
为什么是
android:layout_height="0dp"? -
实际发生了什么?您是否看到物品但高度不正确?你没有看到任何项目吗?您发布的内容没有任何明显错误,但查看您的适配器并了解您现在看到的内容会有所帮助。
-
@Secator 0dp 定义权重是应用于高度还是宽度。所以在这个例子中,权重 1 将应用于高度,因为它设置为 0dp。