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:
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); } }
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With