是否可以使用TwoLineListItem填充ListView?
|
我正在尝试使用具有两行文本的项目创建一个ListView,其中一行具有比另一行更大的字体。 TwoLineListItem似乎是我所需要的,但是每当我尝试像这样运行活动时,应用程序就会崩溃。有什么建议么?
<TableLayout
android:id=\"@+id/tableLayout1\"
android:layout_height=\"match_parent\"
android:layout_width=\"fill_parent\"
xmlns:android=\"http://schemas.android.com/apk/res/android\">
<TwoLineListItem xmlns:android=\"http://schemas.android.com/apk/res/android\"
android:layout_width=\"fill_parent\"
android:layout_height=\"wrap_content\"
android:minHeight=\"?android:attr/listPreferredItemHeight\"
android:mode=\"twoLine\"
>
<TextView android:id=\"@android:id/text1\"
android:layout_width=\"fill_parent\"
android:layout_height=\"wrap_content\"
android:textAppearance=\"?android:attr/textAppearanceLarge\"
/>
<TextView android:id=\"@android:id/text2\"
android:layout_width=\"fill_parent\"
android:layout_marginLeft=\"5dip\"
android:layout_height=\"wrap_content\"
android:layout_below=\"@android:id/text1\"
android:layout_alignLeft=\"@android:id/text1\"
android:textAppearance=\"?android:attr/textAppearanceSmall\"
/>
</TwoLineListItem>
<TwoLineListItem xmlns:android=\"http://schemas.android.com/apk/res/android\"
android:layout_width=\"fill_parent\"
android:layout_height=\"wrap_content\"
android:minHeight=\"?android:attr/listPreferredItemHeight\"
android:mode=\"twoLine\"
>
<TextView android:id=\"@android:id/text1\"
android:layout_width=\"fill_parent\"
android:layout_height=\"wrap_content\"
android:textAppearance=\"?android:attr/textAppearanceLarge\"
/>
<TextView android:id=\"@android:id/text2\"
android:layout_width=\"fill_parent\"
android:layout_marginLeft=\"5dip\"
android:layout_height=\"wrap_content\"
android:layout_below=\"@android:id/text1\"
android:layout_alignLeft=\"@android:id/text1\"
android:textAppearance=\"?android:attr/textAppearanceSmall\"
/>
</TwoLineListItem>
没有找到相关结果
已邀请:
1 个回复
稀瓣囊
方法中将
膨胀,并将您的值绑定到该方法。该布局中的TextView id是
和
。下面是一个与您想要的内容接近的getView()的示例。