我對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