-2
我试图在Android手表脸上绘制图标,但没有在手表脸上看到。 我已经检查过这个链接。 Ref我在复杂性TYPE文本的表盘上设置了文本,但它没有设置为像ICON,RANGED_VALUE,SMALL_IMAGE等其他类型,所以请建议。如何在ICON,RANGED_VALUE,SMALL_IMAGE的手表上设置复杂功能在Android Wear
我需要这种类型的图标,其中红色标记的并发症。 我使用此代码绘制文本。
if (COMPLICATION_IDS[i] == RIGHT_DIAL_COMPLICATION) {
// RIGHT_DIAL_COMPLICATION calculations
int offset = (int) ((mWidth/2) - textWidth)/2;
complicationsX = (mWidth/2) + offset;
canvas.drawText(
complicationMessage,
0,
complicationMessage.length(),
complicationsX,
mComplicationsY,
mComplicationPaint);
Log.e("log", "offset==" + offset + "==complicationsX==" + complicationsX);
Log.e("log", "mComplicationsY==" + mComplicationsY);
}
并使用此代码的形象,但没有得到任何东西。
if (COMPLICATION_IDS[i] == LEFT_DIAL_COMPLICATION) {
complicationsX = (int) ((mWidth/2) - textWidth)/2;
Icon icon = complicationData.getIcon();
Drawable drawable = icon.loadDrawable(getApplicationContext());
if (drawable instanceof BitmapDrawable) {
Bitmap bitmap;
bitmap = ((BitmapDrawable) drawable).getBitmap();
canvas.drawBitmap(bitmap, complicationsX, mComplicationsY, null);
}
}
你是怎样尝试绘制呢?很难看出你在哪里出问题。你能否请包括一些更多的信息/代码?它失败的地方在哪里?你有这个图标但不能画出来吗?也许你根本没有得到这个图标? –
我添加图片,以便您了解我的观点。 –
到目前为止您尝试过什么?你甚至有任何代码向我们展示? – Gattsu