Setting primary color for Android Wear app -
i creating android wear app , trying set it's primary color. create , set theme same way mobile app. every attribute changed correctly except primary color. default teal color android uses. using same theme on companion app , works there. there missing done differently in wear? there override setting?
i have tried changing parent theme material or compact.app.
android manifest:
<application android:name="com.turndapage.navmedia.app" android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/theme.nav">
styles.xml
<resources> <style name="theme.nav" parent="@android:style/theme.devicedefault"> <!-- app branding color app bar --> <item name="colorprimary">@color/primary</item> <!-- darker variant status bar , contextual app bars --> <item name="colorprimarydark">@color/primary_dark</item> <!-- theme ui controls checkboxes , text fields --> <item name="coloraccent">@color/accent</item> <item name="android:colorforeground">@color/primary</item> <item name="android:colorbackground">@color/viewport_background</item> </style>
colors.xml
<resources> <color name="primary">#8c6354</color> <color name="viewport_background">#4d362e</color> <color name="primary_dark">#66483d</color> <color name="action">#a67563</color> <color name="accent">#a1887f</color> <color name="background_shaded">#000000</color> <color name="background">#000000</color> <color name="digital_text">#ffffff</color>
you need use android:
prefix versions:
<style name="theme.nav" parent="@android:style/theme.devicedefault"> <!-- app branding color app bar --> <item name="android:colorprimary">@color/primary</item> <!-- darker variant status bar , contextual app bars --> <item name="android:colorprimarydark">@color/primary_dark</item> <!-- theme ui controls checkboxes , text fields --> <item name="android:coloraccent">@color/accent</item> <item name="android:colorforeground">@color/primary</item> <item name="android:colorbackground">@color/viewport_background</item> </style>
the non-namespaced verisons used appcompat, not needed or used on android wear (theme.devicedefault
extends theme.material
on wear devices).
the colorprimary
not used in surfaces default, you'd still need manually reference via ?android:attr/colorprimary
background of view instance.
note cannot change background color of notifications in stream per this post - however, notification color used when user taps notification (assuming haven't set content intent - in cases, they'll go app).
Comments
Post a Comment