Status bar color on splashscreen

yccycc USMember ✭✭
edited November 2017 in Xamarin.Android

Hi,

I'm currently having a little trouble with my app.
When my app is launched i have a splash screen and the android status bar is black, after some seconds she turns blue and load MainActivity.

I have find some interesting information on stackoverflow to force the color but without success.

In the SplashScreenActivity.cs i have this code :

[Activity(Label = "StatusBar.Android", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, Theme = "@style/SplashScreen")]
    public class SplashActivity : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            StartActivity(typeof(MainActivity));
        }
    }

I also have a styles.xml in my values-v21 forldes with those elements

    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

This refer my color.xml file (in the same folders) containing this :

<resources>
 <color name="colorPrimary">#0d4680</color>
 <color name="colorPrimaryDark">#0d4680</color>
 <color name="colorAccent">#0d4680</color>
</resources>

Can i do something to have my color set on the start of the splashscreen when i click on my app icon and not after his loading ?
The third image is the first screen of linkedIn app, i don't know if she is native or not but it seem to be possible.

Thank for your help.

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    a status bar in a splash screen?....

    post the code of "@style/WsmVisitorReception.SplashScreen"

  • yccycc USMember ✭✭

    Actually i keep the android status bar on the first screen.

    The only line au the style are the tree indicated in my previous post.

    <style name="WsmVisitorReception.SplashScreen" parent="@android:style/Theme.Material.Light">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
      </style>
    
  • yccycc USMember ✭✭
    edited December 2017

    Someone has an idea ?

  • yccycc USMember ✭✭

    I make a little up.

  • yccycc USMember ✭✭

    Little up again, anyone as an idea ?

  • Luis_dmLuis_dm USMember ✭✭✭
    <item name="android:navigationBarColor">#0d3655</item>
    <item name="android:statusBarColor">#0d3655</item>
    
  • yccycc USMember ✭✭

    Hi,

    Thanks for your answer, i'va tried your idea but the result doesn't change.
    The App is launch with the status bar in black and turn to the choosen color after 1s.

  • yccycc USMember ✭✭

    I have opened a ticket on the github of xamarin forms.

    Here is the link if someone is interested : https://github.com/xamarin/Xamarin.Forms/issues/1348

    I'm still open to proposition if someone as an idea.

Sign In or Register to comment.