-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