任何人都可以告訴我如何在偏好活動中實現導航抽屜嗎?Android NavigationDrawer with PreferenceActivity
我的Java代碼。
package com.example.android.navigationdrawerexample;
import android.os.Bundle;
import android.preference.PreferenceActivity;
public class AppPreferences extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.as);
}
}
我的XML代碼:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<EditTextPreference android:title="Your Name"
android:key="username"
android:summary="Please provide your username"></EditTextPreference>
<CheckBoxPreference android:title="Application Updates"
android:defaultValue="false"
android:summary="This option if selected will allow the application to check for latest versions."
android:key="applicationUpdates" />
<ListPreference android:title="Download Details"
android:summary="Select the kind of data that you would like to download"
android:key="downloadType"
/>
</PreferenceScreen>
請人指點我。我在等待你的迴應。
您是否知道任何支持具有PreferenceFragment的導航抽屜的示例? – itsrajesh4uguys
下面是你如何創建一個抽屜:http://developer.android.com/training/implementing-navigation/nav-drawer.html 你插入頁面的片段的類是一個完全indeoendent的東西。 – Ripityom
我現在只在活動的支持下使用該示例。現在我正在嘗試更改以將導航抽屜添加到已經工作的首選項屏幕中。我可以這樣做嗎? – itsrajesh4uguys