Dave's Brain

Browse - Programming Tips - What are the definitions of layouts simple_list_item_1 and simple_list_item_2 that are commonly used

Date: 2012apr26
Platform: Android
Keywords: list, view

Q.  What are the definitions of layouts simple_list_item_1 and simple_list_item_2 that are commonly used
for custom ListView adapters?

A.

android.R.layout.simple_list_item_1:

<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" style="?android:attr/listItemFirstLineStyle" android:paddingTop="2dip" android:paddingBottom="3dip" android:layout_width="fill_parent" android:layout_height="wrap_content" />
android.R.layout.simple_list_item_2:
<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android" android:paddingTop="2dip" android:paddingBottom="2dip" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@android:id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content" style="?android:attr/listItemFirstLineStyle"/> <TextView android:id="@android:id/text2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@android:id/text1" style="?android:attr/listItemSecondLineStyle" /> </TwoLineListItem>

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.