jessiPP
jessiPP

Reputation: 446

Set Status Bar Color in nativescript

I am trying to follow this code example here: https://www.youtube.com/watch?v=NroxMDGOJ_E but it does not work anymore, at least the change status bar color part. The page.androidStatusBarBackground property does not work anymore. Is there a reliable way to change the background color of the statusbar in android using nativescript core?

Upvotes: 1

Views: 723

Answers (1)

Vikas Acharya
Vikas Acharya

Reputation: 4152

very simple

  • go to App_Resources\Android\src\main\res\values\styles.xml
  • check with this code and compare yours
<style name="LaunchScreenThemeBase" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="toolbarStyle">@style/NativeScriptToolbarStyle</item>

        <item name="colorPrimary">@color/ns_primary</item>
        <item name="colorPrimaryDark">@color/ns_primaryDark</item>
        <item name="colorAccent">@color/ns_accent</item>
        <item name="android:windowBackground">@drawable/splash_screen</item>

        <item name="android:statusBarColor">@color/ns_primaryDark</item>
        <item name="android:windowLightStatusBar">true</item>

        <item name="android:windowActionBarOverlay">true</item>
        <item name="android:windowTranslucentStatus">true</item>

    </style>

the important thing is android:statusBarColor & android:windowLightStatusBar

note : it should work fine, you better delete platforms and node_modules folder and run tns run android fresh. It will perfectly work

Upvotes: 1

Related Questions