我正在使用 CanvasWatchFaceService.Engine 开发表盘
我需要检测 watch 是圆形还是方形。
我重写了 onApplyWindowInsets,但它没有被调用。
我应该设置一个特定的监听器或类似的东西吗?
最佳答案
根据我的经验,onApplywindowInsets
只会在您使用 Theme.DeviceDefault
或从它派生的主题时被调用。如果您使用的是完全自定义的主题,则不会调用它。
因此,在您表盘的 list 中,您的 application
标签需要如下所示:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault" >
或者,如果您有表盘服务的主题,它将覆盖它。
关于wear-os - onApplyWindowInsets 未在 CanvasWatchFaceService.Engine 中调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28347357/