我们知道很多软件都有设置菜单项如微信墨迹天气等的设置界面。当设置里有很多选项这时我们可以选择使用ListView实现。
布局文件如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/splash_background"
>
<ListView android:id="@+id/more_List"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@drawable/list_bottom_line"
android:listSelector="#00000000"
android:cacheColorHint="#00000000">
</ListView>
</LinearLayout>
很简单只有一个ListView
item的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dip"
android:background="@drawable/list_item"
>