Show up-Button in actionBar in subscreen preferences

后端 未结 3 822
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-31 09:30

I\'ve implemented my preferences like shown in the official guidelines.

I have a PreferenceActivity which creates the PreferenceFragment like this:

          


        
3条回答
  •  天涯浪人
    2020-12-31 10:15

    I do this per the Android docs in the "Supporting older versions with preference headers" section http://developer.android.com/guide/topics/ui/settings.html#BackCompatHeaders. Using the legacy PreferenceActivity, you specify a Preference in the xml that launches an intent to the same preference activity class. The activity checks the intent action and determines if it is nested or not (to show the up button) and which preference xml to inflate in the screen.

    Of course, I intend to support older devices as well. I have found that the PreferenceFragment is only useful for large tablets that use preference headers.

    To reuse preferences between phones and tablets I came up with this solution https://stackoverflow.com/a/20806812/1139784

提交回复
热议问题