Create line under list item
ListView doesn’t have under line by default.
How do I make it?
To create line under each items, we add line in item layout, not ListView
Samples
list.xml
List.xml is main view including ListView
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/menu"
android:orientation="vertical"
android:background="#5a5a5a"
android:layout_width="1dp"
android:layout_height="1dp">
<ListView android:id="@+id/pack_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#5a5a5a"
android:cacheColorHint="#5a5a5a"
android:scrollbars="none"
android:dividerHeight="1dp" android:footerDividersEnabled="true" android:headerDividersEnabled="true">
</ListView>
</LinearLayout>
list_item.xml
list_item.xml is item for ListView
The point is last thing View. It’s line
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/image"
android:layout_margin="5dip"
android:layout_width="80dip"
android:layout_height="80dip"
/>
<TextView
android:id="@+id/text"
android:choiceMode="singleChoice"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:textColor="#ffffffff"
/>
</LinearLayout>
<View
android:layout_width="fill_parent" android:layout_height="1dp"
android:background="#ffffffff" />
</LinearLayout>
