【发布时间】:2011-09-18 03:09:12
【问题描述】:
我的列表项布局存在我无法理解的问题。我将列表项的高度设置为 70dp,但如果我只有总高度为 40dp 的内容,它将自动忽略我使用 android:layout_height 设置的值,而是使用似乎是 wrap_content 作为高度。
如果我在列表之外使用 exakt 相同的布局,它会按预期工作。
下面是我的一个列表中的一个列表项的布局。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_height="70dip"
android:layout_width="fill_parent">
<TextView android:id="@+id/name"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
style="@style/NormalText"/>
<TextView android:id="@+id/description"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
style="@style/VerySmallLightText"/></LinearLayout>
编辑我的 xml 以更好地反映我的代码。我有一些样式属性,这就是为什么我在这里手动绑定时不小心打错了。
【问题讨论】: