简体   繁体   中英

Wear OS watchface with complications ambient colour

I'm designing my first watch face (just for me) I've been through the "Adding Complications to your Wear OS Watch Face" codelab ( https://developer.android.com/codelabs/complications#0 ) and I would like to make the complications a darker grey (in the sample they show as white) when in ambient mode. An added complication (the normal kind, not the watch face kind) is that it seems to work in the android emulator, but not on my physical device (Ticwatch C2+, I don't have another to test it with).

I've been through everywhere I can look and the sensible place seems to be in custom_complication_styles.xml which I have edited as below:

<ambient
        app:backgroundColor="@android:color/black"
        app:borderRadius="50dp"
        app:borderStyle="solid"
        app:borderWidth="1dp"
        app:highlightColor="@color/gray"
        app:iconColor="@color/gray"
        app:rangedValuePrimaryColor="@color/gray"
        app:titleColor="@color/gray"
        app:textColor="@color/gray"
        app:borderColor="@android:color/transparent"
        app:rangedValueSecondaryColor="@android:color/transparent"/>

The colours come from the colours.xml in the sample project, which (sensibly) includes gray. Just to make sure it isn't just my eyes not seeing the colours properly, I've tried something really obvious, like blue, and it still shows as white.

Adding the border information seems to work (initially in the sample there were no borders), but it doesn't seem to matter what I change the colours to, they are always white. I have tried this with an unedited copy of the sample with the same outcome.

I can change the colour of other elements of the watchface in ambient mode, just not the complications.

Hopefully, it is something really obvious and easy to someone out there, but documentation/tutorials seem a bit thin on the ground for wear os development. Thanks in advance to whoever can help!

TofferJ's comment was the answer I was looking for, disabling low bit ambient on the watch means the complications now use the colour set in the styles xml. Thanks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM