Android studio preview pane doesn't create ActionBar?

I am running the latest version of android studio, the problem in the preview area does not display the ActionBar when using any of AppCompat themes, if I change the theme of the preview panel, it works fine (does not change the current theme), but is there any disagreement on this

my styles.xml is as follows

<resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> </style> </resources> 

when the preview area is set to AppTheme, the ActionBar does not appear, however it works fine on my device and AVD,

No Action Bar shown

As you can see, this makes debugging and testing the ActionBar difficult.

Please suggest a little fix for this, and how exactly does the AppCompat theme differ from the usual one? I'm just a beginner android.

Thanks!

+7
android android-studio android-actionbar android-styles android-theme
source share
3 answers
+12
source share

In my .xml styles I had

  <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"> 

had to change it to

  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
+1
source share

There is a culprit in your MainActivity (which your activity has ever been), when you use app.compact.v7, you should extend ActionBarActivity instead of Activity

-one
source share

All Articles