我知道在安卓系统中simple_list_item1是用来创建ListView的。simple_list_item2是用来做什么的?另外,如何更改ListView的整体外观?
示例代码: ListView lv;lv.setAdapter( ArrayAdapter(this,android.R.layout.simple_list_item_1,results));
发布于 2012-06-07 18:36:23
simple_list_item2是一个LineListItem表示只有一个TextView
<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="match_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceListItemSmall" android:gravity="center_vertical" android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" android:paddingRight="?android:attr/listPreferredItemPaddingRight" android:minHeight="?android:attr/listPreferredItemHeightSmall" />simple_list_item2 is TwoLineListItem意思是有2个TextViews......
<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:mode="twoLine">
<TextView android:id="@android:id/text1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="?android:attr/listPreferredItemPaddingLeft" android:layout_marginTop="8dip" android:textAppearance="?android:attr/textAppearanceListItem" />
<TextView android:id="@android:id/text2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@android:id/text1" android:layout_alignLeft="@android:id/text1" android:textAppearance="?android:attr/textAppearanceSmall" />
</TwoLineListItem>在http://mylifewithandroid.blogspot.in/2008/03/my-first-meeting-with-simpleadapter.html中使用
https://stackoverflow.com/questions/10930075
复制相似问题