你已經擁有了你需要的所有東西。唯一缺少的是根據複雜類型設置邊界。這就是我的做法:
// Create a ComplicationDrawable object, and give it a Context.
ComplicationDrawable complicationDrawable = new ComplicationDrawable();
complicationDrawable.setContext(context);
// Set the ComplicationData from the onComplicationDataUpdate(int id, ComplicationData data) callback in your WatchFaceService.Engine class.
complicationDrawable.setComplicationData(data);
// Set the bounds based on the current complication type.
Rect bounds = new Rect();
if (data.getType() == ComplicationData.TYPE_LONG_TEXT) {
bounds.set(getLongTextBounds());
} else {
bounds.set(getShortTextBounds());
}
complicationDrawable.setBounds(bounds);
// Set all other customization options, and draw the ComplicationDrawable to your canvas.