possibility of showing action bar in nested PreferenceScreen activity

1,696 views
Skip to first unread message

AT M

unread,
Jan 14, 2013, 12:05:56 PM1/14/13
to actionba...@googlegroups.com
I have a SherlockPreferenceActivity that uses addPreferencesFromResource to load data from preferences.xml file. Inside xml, I have a PreferenceScreen with another nested PreferenceScreen (which in turn has several sub-Preferences):

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
   <PreferenceScreen
        android:summary="@string/part1_description"
        android:title="@string/part1_title" > 
        <Preference
            android:summary="@string/chapter1_description"
            android:title="@string/chapter1_title" >       
        </Preference>
        <Preference
            android:summary="@string/chapter2_description"
            android:title="@string/chapter2_title" >       
        </Preference>
   </PreferenceScreen>
   <PreferenceScreen
        android:summary="@string/part2_description"
        android:title="@string/part2_title" >
        <Preference
            android:summary="@string/chapter3_description"
            android:title="@string/chapter3_title" >       
        </Preference>
        <Preference
            android:summary="@string/chapter4_description"
            android:title="@string/chapter4_title" >       
        </Preference>
   </PreferenceScreen>
...
</PreferenceScreen>

Parent Activity with PreferenceScreen (listing Parts) is showing action bar perfectly, but when I go to any of the nested PreferenceScreen classes (which consequently open a new internal Activity with appropriate Chapters), action bar disappears. I guess that this problem can be solved by creating additional Activity for sub-PreferenceScreen class (using intents), but just wondering, is there any other better solution?

Thanks in advance.

Jake Wharton

unread,
Jan 14, 2013, 12:13:01 PM1/14/13
to actionba...@googlegroups.com
This cannot be done unfortunately. See: https://github.com/JakeWharton/ActionBarSherlock/issues/447

AT M

unread,
Jan 14, 2013, 12:16:30 PM1/14/13
to actionba...@googlegroups.com
  It's a pity, thanks anyway. I will try to dig to other directions :-).

Tom anMoney

unread,
Jan 15, 2013, 10:33:32 AM1/15/13
to actionba...@googlegroups.com
Yes, it can be done.  It's not easy, but possible.

See my app for an example:

Vladi

unread,
Nov 24, 2015, 10:24:43 AM11/24/15
to ActionBarSherlock
Will you tell us how or we need to decompile that app to see? :)
Reply all
Reply to author
Forward
0 new messages