第一步: OnCreate添加布局

addPreferencesFromResource(R.xml.remind_setting);
setContentView(R.layout.remind_preference);

第二步,添加布局文件 remind_preference.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background_setting"
    android:orientation="vertical" >

    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >
    </ListView>

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        style="@android:style/ButtonBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/button_save"
            android:layout_width="140dip"
            android:layout_height="wrap_content"
            android:ellipsize="marquee"
            android:singleLine="true"
            android:text="保存" />

        <View
            android:layout_width="1dip"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:visibility="invisible" />

        <Button
            android:id="@+id/button_refresh"
            android:layout_width="140dip"
            android:layout_height="wrap_content"
            android:drawablePadding="3dip"
            android:ellipsize="marquee"
            android:singleLine="true"
            android:text="刷新" />
    </LinearLayout>

</LinearLayout>

第三点,注意

必须包含一个id:list的ListView