Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is AppTheme.NoActionBar not working?

I've created an Android app in Android Studio, and it has created these styles by default:

<style name="AppTheme.NoActionBar">     <item name="windowActionBar">false</item>     <item name="windowNoTitle">true</item> </style> 

However, in an activity, I try to set this as a theme:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"    ... android:theme="@style/AppTheme.NoActionBar"> 

But when I run the app I'm getting the action bar:

enter image description here

Why am I getting an action bar? Am I doing something obviously wrong, or is Android Studio, Google's official IDE for it's own platform, trying to confuse/mislead its developers?

Here is my activity code, there's nothing in it that can cause the action bar to appear by itself:

public class WelcomeActivity extends AppCompatActivity {     @Override     public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {         super.onCreate(savedInstanceState, persistentState);         setContentView(R.layout.activity_welcome);     } } 
like image 599
Can Poyrazoğlu Avatar asked Apr 07 '16 14:04

Can Poyrazoğlu


People also ask

How do I set up no action bar?

If you want to hide Action Bar from the entire application (from all Activities and fragments), then you can use this method. Just go to res -> values -> styles. xml and change the base application to “Theme. AppCompat.


1 Answers

Try something like this:

<style name="AppTheme.NoActionBar">     <item name="windowNoTitle">true</item>     <item name="windowActionBar">false</item>     <item name="android:windowFullscreen">true</item>     <item name="android:windowContentOverlay">@null</item>   </style> 

and set this as the theme of your activity in the manifest, that is:

<activity     ...     android:theme="@style/AppTheme.NoActionBar"> </activity> 
like image 100
Mehmet K Avatar answered Sep 19 '22 19:09

Mehmet K