Where is the option to add a new preference screen in Android Studio 0.4.0?

前端 未结 8 1638
梦毁少年i
梦毁少年i 2021-02-07 08:15
Android Studio 0.4.0

Hello,

I want to add a new Preference Screen in Android Studio. However, I cannot find the menu option to do it.

I

8条回答
  •  无人共我
    2021-02-07 08:54

    In Android Studio 1.1.0: If you create a SettingsActivity it automatically sets up some xml preference resource files for you.

    1. Under src > main > java, right click a package (e.g. com.company.appname)
    2. New > Activity > Settings Activity
    3. Click Finish to accept the defaults
    4. Notice the new files:
      • SettingsActivity
      • values/strings_activity_settings.xml
      • xml (Directory)
        • pref_data_sync.xml
        • pref_general.xml
        • pref_headers.xml
        • pref_notification.xml

    Note: The Activity uses some deprecated code. It might be best to look at the latest documentation for creating a preferences activity: http://developer.android.com/reference/android/preference/PreferenceFragment.html and for creating the XML resource file: http://developer.android.com/reference/android/preference/Preference.html

提交回复
热议问题