How to hide the title bar from the very beginning

I use the following code to replace the title bar.

final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); 

And it works fine after loading the user interface. The problem, however, when I launch the application, an ugly gray bar appears for 1-2 seconds until the user interface loads. Is there a way to specify not to show the default title bar?

+6
source share
3 answers

If you want the title to appear in every activity in your application, add

 <application android:name=".YourAppNameHere" android:label="@string/app_name" android:icon="@drawable/icon" android:theme="@android:style/Theme.NoTitleBar"> 

to your manifest. Not 100% sure that this will prevent the header from displaying briefly, but it should work.

+12
source

In the manifest file, add this line inside the application tag

 android:theme="@android:style/Theme.NoTitleBar" 

It will hide the panel from all actions. If you want to hide it from a specific action, add the same line to this activity tag.

Good luck

+4
source

You should add a line to your AndroidManifest that says you are using a theme (standard android or advanced)

 <application android:name=".YourAppNameHere" android:label="@string/app_name" android:icon="@drawable/icon" android:theme="@style/MyTheme"> 

and then you can have topic.xml in your res / values ​​/ folder, where you expand: Theme.NoTitleBar and add custom rules to them (like windowBackground for example)

 <resources> <style name="MyTheme" parent="android:Theme.NoTitleBar"> <item name="android:windowBackground">@drawable/my_background</item> </style> <resources> 

Good luck

+1
source

Source: https://habr.com/ru/post/902060/


All Articles