Android Question [solved] setting navigationBarColor in manifest: need AppCompat?

Dave O

Well-Known Member
Licensed User
Longtime User
Hi all,

I've added support for dark mode in one of my apps, but when I try to specify a black navigationBarColor for the dark theme, nothing happens (it stays white).

Here's my manifest code:

XML:
CreateResource(values-v20, theme.xml,
<resources>
    <style name="MyDarkTheme" parent="@android:style/Theme.Material">
        <item name="android:colorBackground">#000000</item>
        <item name="android:colorOnBackground">#AAAAAA</item>
        <item name="android:colorPrimary">#146414</item>
        <item name="android:colorPrimaryDark">#096E00</item>
        <item name="android:colorPrimaryVariant">#096E00</item>
        <item name="android:colorSecondary">#7F003E</item>
        <item name="android:colorSecondaryVariant">#4C0025</item>
        <item name="android:colorOnSecondary">#AAAAAA</item>
        <item name="android:colorAccent">#146414</item>
        <item name="android:textColor">#8C8C8C</item> <!-- ? -->
         <item name="android:textColorPrimary">#8C8C8C</item>
        <item name="android:textColorSecondary">#606060</item>
        <item name="android:textColorLink">#146414</item>
        <item name="android:textColorHighlight">#146414</item>
        <item name="android:windowTranslucentStatus">false</item>
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:statusBarColor">#FF000000</item>
        <item name="android:navigationBarColor">#FF000000</item>
    </style>
(etc.)


I'm not using AppCompat in this app (haven't had a need for it yet, and it seems like some work to set up). Is this a case where I'd need to add the AppCompat library and put this line in my activity?

B4X:
#Extends: android.support.v7.app.AppCompatActivity

Or is something else preventing the navigationBarColor from working?

Thanks!
 

Dave O

Well-Known Member
Licensed User
Longtime User
After lots of debugging and comparing to working code, I finally found out that my code is just fine.

The problem was the theme.xml file I was trying to create in the manifest was already there and read-only, so no matter what changes I made, the XML always stayed the same.

Rookie mistake, after all that head-scratching. <sigh>
 
Upvote 0
Top