How to add Action Bar from support library into PreferenceActivity?

后端 未结 8 527
不思量自难忘°
不思量自难忘° 2020-11-27 09:15

Action Bar compatibility has been added into support library, revision 18. It now has ActionBarActivity class for creating activities with Action Bar on older versions of An

相关标签:
8条回答
  • 2020-11-27 10:08

    Now the official answer for this problem has been released. It is the v7/v14 Preference Support library.

    See How to use the v7/v14 Preference Support library? for the discussion how to use it.

    0 讨论(0)
  • 2020-11-27 10:09

    Integrating PreferenceActivity with ABC is not possible, at least for me. I tried the two possibilities I could find but none worked:

    Option 1:

    ActionBarPreferenceActivity extends PreferenceActivity. When you do this you get restricted by ActionBarActivityDelegate.createDelegate(ActionBarActivity activity). Also you need to implement ActionBar.Callbacks which is not accessible

    Option 2:

    ActionBarPreferenceActivity extends ActionBarActivity. This approach requires rewriting a whole new PreferenceActivity, PreferenceManager and may be PreferenceFragment which means you need access to hidden classes like com.android.internal.util.XmlUtils The solution to this can only come from Google devs implementing an ActionBarWrapper that can be added to any activity.

    If you really need a preference activity, my advice for now is ActionBarSherlock.

    However, I managed to implement it here.

    0 讨论(0)
提交回复
热议问题