在 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 - 查看 onSurfaceChanged
和 onPeekCardPositionUpdate
方法。
关于wear-os - 在CanvasWatchFaceService.Engine onDraw中, Canvas 的宽度和高度可以与边界提供的不同吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28473864/