androidandroid-actionbarandroid-titlebarcustom-titlebar

Default title bar displayed before my custom title bar appears


I' developing an android app and I need to use my custom title bar using a picture and two buttons. The thing is, immediately when I launch my app, during 1 or 2 seconds before my custom title bar appears, there is the ugly default one with "my application" displayed. The minimum targeted API is 15.

All the answers found on stack overflow didn't work, or succeed to make it disappear but was doing the same to my custom title bar.

Here is how I call it from my activity:

supportRequestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
super.onCreate(savedInstanceState);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.topbarclassic);

Since my first view is a fragment I dont call SetContentView

And this is my custom styles.xml:

<resources>

    <style name="theme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowTitleSize">50dp</item>
        <item name="android:windowNoTitle">false</item>
    </style>

</resources>

Once again my custom title bar works properly. I just need to get rid of the default one displayed quickly when the app starts. Thanks a lot!


Solution

  • If found a workaround for my problem using Modge's link about splashscreen.

    It doesn't solve the problem itself but remains a good workaround.

    I created a small activity in charge of the splash screen, avoiding the white first screen to stay for too long. Then this splash redirect on my main activity.

    This is also useful in my case since I can start some connection process during the splash screen. You can follow this example: http://www.androidhive.info/2013/07/how-to-implement-android-splash-screen-2/