Reputation: 1596
I'm using Theme.MaterialComponents.DayNight.NoActionBar
for my activity. My goal is to create an activity with no title bar and make the notification bar background as same as app background colour. Everything works fine under normal condition. But when I enable dark theme from the device settings, the title bar suddenly appears. How can I get rid of title bar for both dark light theme?
Upvotes: 2
Views: 1118
Reputation: 228
Not sure why is has not been mentioned yet but @android:style/Theme.Black.NoTitleBar
worked way better for me.
Just in case someone is still searching for another solution than the provided ones.
Upvotes: 1
Reputation: 373
you can do it programmatically as well :
this.requestWindowFeature(Window.FEATURE_NO_TITLE)
this.window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
add this in you oncreate call and before setcontent view.
as :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
this.requestWindowFeature(Window.FEATURE_NO_TITLE)
this.window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main)
}
Upvotes: -1
Reputation: 412
By default in the themes folder, there will be a normal one and night version
change the parent theme in both to parent="Theme.MaterialComponents.DayNight.NoActionBar"
like below
and the theme in manifest to style name in these two themes(same name) for me here android:theme="@style/Theme.Advice">
in manifest
Upvotes: 6
Reputation: 1
Simply go to the Android Manifest file and change NoActionBar to NoTitleBar https://www.xspdf.com/resolution/20749671.html
Upvotes: 0