嵌套的PreferenceScreens会丢失自定义PreferenceActivity布局
我有一个首选项活动,它从以下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方法以清除listview中的首选项并从适当的XML文件重新加载首选项来修复(Kludged)。
没有找到相关结果
已邀请:
2 个回复
凸晴
讼乐