*設定画面にボタンを付ける [#e1ddebff] 設定画面にボタンを付けるためには、layoutを用意する必要があります。~ PreferenceActivityの派生元はListActivityなので、layoutにはListViewを用意する必要があります。 PreferenceActivityの派生元はListActivitです。~ 用意するlayoutでListViewを用意することで、設定画面のレイアウトがListViewのところに適用されます。~ #codeprettify{{ <?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:orientation="vertical" > <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" > </ListView> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" > <Button android:id="@+id/btnOK" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/lb_grp_btn_ok" /> <Button android:id="@+id/btnCancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/lb_grp_btn_cancel" /> </LinearLayout> </LinearLayout> }} レイアウトに追加するListViewのidは''@android:id/list''である必要があります。 で、PreferenceActivityの派生クラスでは、setContentView()メソッドで、layoutのxmlを指定します。 #codeprettify{{ class DemoActivity extends PreferenceActivity{ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.prefarence_btn); addPreferencesFromResource(R.xml.prefarence); ・・・ } }} **参考 [#t2a39cdc] -[[PreferenceActivityのレイアウトカスタマイズ>http://d.hatena.ne.jp/kaw0909/20110403/1301827783]]