wear-os - 在CanvasWatchFaceService.Engine onDraw中, Canvas 的宽度和高度可以与边界提供的不同吗?

标签 wear-os

在 CanvasWatchFaceService.Engine 中执行 public void onDraw (Canvas canvas, Rectbounds) 方法。 文档说

Draws the watch face.
Parameters
canvas  the canvas to draw into
bounds  the bounds in which the watch face should be drawn

是否存在边界与 Canvas 的高度和宽度不同的情况?

它与从中检索的宽度和高度有何不同 public void onSurfaceChanged(SurfaceHolderholder,int格式,int宽度,int高度)

最佳答案

我只是在这里推测,但在我看来它们可能不同,因为边界(矩形)是 Canvas 的尺寸,而宽度和高度与正在渲染的 View 有关。

从技术上讲,您可以draw outside the bounds Canvas ,但我想操作系统本身不会这样做。

一个很好的引用是 Muzei source code - 查看 onSurfaceChangedonPeekCardPositionUpdate 方法。

关于wear-os - 在CanvasWatchFaceService.Engine onDraw中, Canvas 的宽度和高度可以与边界提供的不同吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28473864/

相关文章:

android - 从 Wear 向手机 [MessageAPI] 发送消息时未收到消息

java - Android Wear 防止 sleep

wear-os - Java Wear os 通过数字皇冠滚动WearableRecyclerView

Android Wear Volley onResponse 错误 null

android - 蓝牙 Controller 和控制台之间的游戏命令格式

java - 以编程方式使 Android 可穿戴设备静音

wear-os - WearableDataListener 服务不调用 onDataChanged 方法

android - 如何以编程方式打开 Android Wear 键盘?

android - Android Wear 中的 Kiosk 模式/屏幕固定

wear-os - onApplyWindowInsets 未在 CanvasWatchFaceService.Engine 中调用