次の XML からレイアウトを取得する設定アクティビティがあります。これにより、設定の下部にボタンが表示されます。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.stealthcopter.nexus.nexusgl"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ListView android:id="@android:id/list"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<Button android:text="This is a button on top of all preferences."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
ただし、内部にネストされた PreferenceScreen を開くと、リストビューのみの表示に戻ります。設定画面間でレイアウトを同じに保つ簡単な方法はありますか?
PreferenceScreen.setLayoutResource(R.id.layout.main); を試しました。しかし、それは開かれる前に表示されるビューを変更するだけです
アップデート
ネストされた PreferenceScreens を通常の設定に変更し、onclick メソッドをオーバーライドしてリストビューから設定をクリアし、適切な XML ファイルから設定をリロードすることで、これを修正 (Kludged) しました。