Android 列表项忽略设置高度,改为使用换行内容
我的列表项布局有问题,我无法理解。我将列表项的高度设置为70dp,但如果我只有总高度为40dp的内容,它将自动忽略我用android:layout\u height设置的值,而使用似乎是wrap\u内容的值作为高度 如果我在列表之外使用相同的布局,它将按预期工作 下面是我的一个列表中的列表项的布局Android 列表项忽略设置高度,改为使用换行内容,android,listview,layout,Android,Listview,Layout,我的列表项布局有问题,我无法理解。我将列表项的高度设置为70dp,但如果我只有总高度为40dp的内容,它将自动忽略我用android:layout\u height设置的值,而使用似乎是wrap\u内容的值作为高度 如果我在列表之外使用相同的布局,它将按预期工作 下面是我的一个列表中的列表项的布局 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="ver
<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以更好地反映我的代码。我在样式中有一些属性,这就是为什么我在这里手动绑定时不小心输入了一个错误。您的linearlayout属性如下所示
android:height='70dip'是否可以通过IDE检查 您是否尝试过线性布局的布局高度而不仅仅是高度
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_height="70dp"*
android:layout_width="fill_parent">
typo就我而言,我当然有代码的布局高度:9更改我的帖子以反映这一点现在更新了我发布的代码,我在这里写代码时只是一个拼写错误