Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Actionbar not showing in the development preview

Actionbar not showing in the development preview but showing normally after running the app, minimum api is 15, tried to delete the them from the manifest file, didn't show the actionbar, and can't run the app anymore.

It is a completely new project (tried deleting it and recreating it and creating several other with different minimum api, still not showing in the development)

My theme is blank with a parent "parent="Theme.AppCompat.Light.DarkActionBar""

Trying to use a holo light theme, crashed and got that error "java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity."

Default activity extends actionbaractivity instead of activity, fixed now. Thanks

like image 282
tan Avatar asked Feb 09 '15 12:02

tan


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 ActionBar and toolbar?

The Toolbar is basically the advanced successor of the ActionBar. It is much more flexible and customizable in terms of appearance and functionality. Unlike ActionBar, its position is not hardcoded i.e., not at the top of an activity.

How do I get the action bar?

You may otherwise add the action bar by calling requestFeature(FEATURE_ACTION_BAR) or by declaring it in a custom theme with the windowActionBar property. Beginning with Android L (API level 21), the action bar may be represented by any Toolbar widget within the application layout.


2 Answers

If you can't see the action bar AND also the status bar or buttons, it could be because the "Show Layout Decorations" options is turned off in the Layout Editor. Just check this option and everything should be displayed again. As per Android Studio 3.3:

Turning on Layout Decorations in Android Studio 3.3

like image 175
schv09 Avatar answered Oct 14 '22 02:10

schv09


Check which theme is selected on the top of the XML preview screen.

enter image description here

Even if you're using Eclipse, it will look similar.

Your application is displaying the ActionBar because your AndroidManifest has a theme which displays the ActionBar.

like image 41
Machado Avatar answered Oct 14 '22 00:10

Machado