Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the actionbar before the Activity is loaded?

My goal is to show a splash screen on my applications startup. Right now what it will do is briefly show the actionbar with an otherwise blank page, then jump to the splash screen. I'm trying to figure out how to not show the beginning screen and just start with the splash screen. I'm trying to use these links for information on how to solve this.

ActionBar Lag in hiding title In this one I'm assuming I can use the same type of method for hiding the actionbar by changing the theme, but I don't know what I would actually use as my style to do so.

How to hide action bar before activity is created, and then show it again? and here it talks about adding a line to the manifest that would do it. Where in the manifest? Anywhere I put it did not do anything.

like image 561
damian Avatar asked Jul 11 '12 14:07

damian


People also ask

Which of the ways can be used to hide the ActionBar in Android?

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.

How do I hide action bar in one activity?

If we want to remove the ActionBar only from specific activities, we can create a child theme with the AppTheme as it's parent, set windowActionBar to false and windowNoTitle to true and then apply this theme on an activity level by using the android:theme attribute in the AndroidManifest. xml file.

How do I hide the action bar on Kotlin?

You can directly hide Action Bar for a specific activity by specifying the NoActionBar theme in its activity tag in the manifest file. For this simply navigate to your projects' root and open the Android manifest file and add a single line of code as mentioned below.

Which method is used to hide the activity title?

The requestWindowFeature(Window. FEATURE_NO_TITLE) method of Activity must be called to hide the title.


2 Answers

try this in manifest file

<activity
        android:name="yourActivityName"
        android:label="your label"
        android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen" >

    </activity>
like image 133
Mohsin Naeem Avatar answered Oct 20 '22 17:10

Mohsin Naeem


Check this link Android: hide action bar while view load

Code snippets from the link, incase the link breaks down, courtesy @kleopatra:

Setting the properties windowNoTitle to true on your theme will hide the ActionBar. use two different themes both extending parent="Theme.AppCompat.Light" in order to prevent NPE when using getSupportActionBar

set the styles as

<style name="AppThemeNoBar" parent="Theme.AppCompat.Light">
        <item name="android:windowNoTitle">true</item>
</style>
<style name="AppThemeBar" parent="Theme.AppCompat.Light">
        <item name="android:windowNoTitle">false</item>
</style>

Due to some odd behaviour on versions < 11, you need to add

if (Build.VERSION.SDK_INT < 11){ getSupportActionBar().hide(); }

inside activities that do not need the actionbar

like image 45
Laranjeiro Avatar answered Oct 20 '22 18:10

Laranjeiro