Issue
My objective is removing the orange bar thar has the label "App name".
Currently I have a top_app_bar and bottom_nav_bar. As far as I know the orange bar is generated by the bottom nav bar.
This is the bottom nav bar implementation in the activity_main.
This is the top app bar implementation in the activity_main.
Solution
The top bar is called ActionBar
. The ActionBar is a part of the default layout of the theme you are using.
Method 1:
You can hide the ActionBar by creating a NO ActionBar Style in the Style.xml and setting the class's style to that.
In Style.xml
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
Then In the Manifest set the theme for the class to this NoActionBar
Style.
In AndroidManifest.xml
<activity
android:name=".MainActivity"
android:theme="@style/AppTheme.NoActionBar" />
Method 2
Simply add a default NoActionBar Style in Manifest
<activity android:name=".MainActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
Method 3
You can do it programmatically
Java
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
}
Kotlin
supportActionBar?.hide()
Answered By - K M Rejowan Ahmmed
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.