简体   繁体   中英

How can I use Views in a Watchface for Wear OS?

When I want to insert a view in my watchface (class: CanvasWatchFaceService), findViewById is not resolved. I need it for AnimatedDrawable.

I wrote a blog post on the subject a few years back: Layout-based Watch Faces for Android Wear . Because it was written in 2015, a few details have changed - like the name of the OS, and steps for creating the initial project in Android Studio - but the general approach still works.

Also, here's a more recent sample where I used the technique specifically for animations: https://github.com/StringMon/io18watchface

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