Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio preview pane not rendering ActionBar?

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!

like image 386
Sainath S.R Avatar asked Dec 29 '14 08:12

Sainath S.R


People also ask

Where is ActionBar in Android?

Android ActionBar is a menu bar that runs across the top of the activity screen in android. Android ActionBar can contain menu items which become visible when the user clicks the “menu” button.

What is the difference between appbar and toolbar in Android?

The key differences that distinguish the Toolbar from the ActionBar include: Toolbar is a View included in a layout like any other View. As a regular View , the toolbar is easier to position, animate and control. Multiple distinct Toolbar elements can be defined within a single activity.

What is ActionBar in Android Studio?

The app bar, also known as the action bar, is one of the most important design elements in your app's activities, because it provides a visual structure and interactive elements that are familiar to users.

What is an ActionBar?

An on-screen toolbar displaying icons that are clicked or tapped to perform various functions. For example, the menu bar at the top of an Android app is called an action bar.


2 Answers

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

like image 132
Menachem Hornbacher Avatar answered Sep 21 '22 10:09

Menachem Hornbacher


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">
like image 36
M. Doe Avatar answered Sep 21 '22 10:09

M. Doe