ListActivity использует расширение BaseAdapter и следующий макет:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/application_background_color">
<ListView android:id="@android:id/list" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:drawSelectorOnTop="false"
android:divider="@drawable/divider"
android:dividerHeight="2dip" android:clickable="true"
android:choiceMode="singleChoice"
android:cacheColorHint="@color/application_background_color">
</ListView>
</LinearLayout>
Он надувает следующий макет для строк:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView android:id="@+id/Row"
android:layout_width="fill_parent" android:layout_height="50dip"
android:textSize="20dip" android:textColor="#000000"
android:layout_margin="8dip"
android:gravity="center_vertical"></TextView>
</LinearLayout>
Drawable / divr.xml выглядит следующим образомэто на данный момент, но я пробовал все виды:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:color="#FF000000">
</stroke>
</shape>
Если я читаю отрисовку из изображения, это работает.Почему это не работает, когда я определяю drawable как файл .xml?
Обновление :
Код соответствует той же схеме, что и EfficientAdapter в примерах для разработчиков Android:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html