After I upgraded to the Support Library v21 my ActionBar in my PreferenceActivity
is gone.
Did I miss some attributes in my theme to activate it again? I had some similar trouble with a black ActionBar.
I also tried to add it a little hackish by adding a Toolbar
to the root layout, but that did not work as expected.
Hi I am not if you still have this issue. But I figure I will post what I did to resolve this and hope it will help someone.
1) First off, you might have noticed that PreferenceActivity extends ListActivity which in turns extends from Activity.
According to the comments on the developers blog (http://android-developers.blogspot.com/2014/10/appcompat-v21-material-design-for-pre.html), to use v21 all your activities must inherit from ActionBarActivity. So there is your issue.
2) The steps I used to resolve are :
This should resolve it.
Cheers!
An easy way I figured out is overriding:
In your style:
A better solution than "rolling your own" action bar is to use the AppCompatDelegate class, which lets you bring in an actual-factual action bar from the support library. Here is example code to use it, taken from Ľubomír Kučera's answer to this question.
I ended in adding the Toolbar myself with this simple code:
Here is my preferences_toolbar.xml:
Use AppCompatActivity & PreferenceFragment to solve the issue:
AppCompatActivity:
PreferenceFragment:
I did something similar to accepted question, but I'm using my layout in other activities as well (
MainActivity
too), so I cannot just hard-code an arrow in it.What worked for me: