Android studio preview pane not rendering ActionBar?

16,008

Solution 1

It is a bug: https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=78944

Unfortunately it is low priority.

Update: set the preview to API 22

Solution 2

In my styles.xml I had

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

had to change it to just

 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
Share:
16,008

Related videos on Youtube

Sainath S.R
Author by

Sainath S.R

Love software.Here to get help and give back to the community :) . Currently working as a software developer.

Updated on September 15, 2022

Comments

  • Sainath S.R
    Sainath S.R over 1 year

    I'm running the latest version of android studio ,Problem is the preview pane does not render the ActionBar when any of the AppCompat themes are used, if i change the theme of the preview pane it works fine(Not change actual theme) ,but is there any discepency in doing 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 pane is set to AppTheme ,the ActionBar ain't shown ,however it works fine in my device and AVD,

    No Action Bar shown

    As you can see this makes it hard to debug and test the ActionBar

    Please suggest some fix to this and how exactly does a AppCompat theme differ from an ordinary one?,I'm just an android beginner .

    Thanks!

  • Sainath S.R
    Sainath S.R over 9 years
    I'm sorry i don't really understand ,my Main Activity and fragment do extend ActionBarActivity and moreover i said it works fine on the device etc,only the preview pane is messed up.
  • vinay Maneti
    vinay Maneti over 9 years
    youtube.com/watch?v=h57QpXp2TRg watch this video you can understand
  • lemuel
    lemuel about 9 years
    Is it really? Because I'm noticing a possible side effect: when I select a NoActionBar theme from the Preview tools, it still has an action bar.
  • Menachem Hornbacher
    Menachem Hornbacher about 9 years
    It was fixed with minor issues in platform tools 22
  • lemuel
    lemuel about 9 years
    Weird. I definitely have platform tools 22. I'm not setting any Activity context in xmlns:tools. The ActionBar is there, my ToolBar goes below it even if I chose Theme.AppCompat.NoActionBar from the preview pane. Unrelated, but just to be clear: I just extend Activity (because I'm using Flow), and my AppTheme is also Theme.AppCompat.NoActionBar.
  • Menachem Hornbacher
    Menachem Hornbacher about 9 years
    Read the link. There is still isuues in some configurations
  • vishal dharankar
    vishal dharankar almost 9 years
    Question is about preview and not runtime appearance .