我对Android的偏好系统很陌生,目前我面临一个问题。如何强制子PreferenceScreen包含在片段布局(Android)
根据Android指南(http://developer.android.com/guide/topics/ui/settings.html)的建议,我使用偏好片段。因此,我的设置活动包含一些东西(如标题,标签等标题)和下面的PreferenceFragment。
事情是,当我点击与“子”PreferenceScreen相关的首选项时,“新的首选项屏幕”不尊重我的片段的布局,而是填充整个活动。
下面是一个例子:比方说,我有一个调用addPreferenceFromResource(R.xml.preferences)的PreferenceFragment。 preferences.xml确实包含“更改密码”首选项,该首选项是包含3 TextEditPreference的PreferenceScreen。
的preferences.xml
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<EditTextPreference android:title="@string/pref_one"/>
<EditTextPreference android:title="@string/pref_two"/>
<PreferenceScreen android:title="@string/pref_change_password">
<EditTextPreference android:title="@string/pref_current_pass"
android:inputType="textPassword"
android:hint="@string/hint_current_password" />
<EditTextPreference android:title="@string/pref_new_pass"
android:inputType="textPassword"
android:hint="@string/hint_new_password" />
<EditTextPreference android:title="@string/pref_confirm_new_pass"
android:inputType="textPassword"
android:hint="@string/hint_confirm_new_password" />
</PreferenceScreen>
</PreferenceScreen>
我该怎么办那? 非常感谢您的回答!
它的工作。但没有影子。你需要处理自己的操作栏图标后按。 – motis10