[英]Images Sony Smartwatch 2
我正在嘗試在Sony Smartwatch UI中顯示外部圖像(不在我的應用程序項目中)。 我知道如何處理可繪制文件夾中的圖像。
Bundle iconBundle = new Bundle();
iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.thumbnail);
iconBundle.putString(Control.Intents.EXTRA_DATA_URI,
ExtensionUtils.getUriString(mContext, R.drawable.thumbnail_list_item));
在此示例中,我將圖像保存在名為R.drawable.thumbnail_list_item的可繪制文件夾中。 問題是當我嘗試使用外部圖像時。 我有以下URL: http : //tcset.com/images/logotcsetarriba.png ,此代碼不起作用:
Bundle iconBundle = new Bundle();
iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.thumbnail);
iconBundle.putString(Control.Intents.EXTRA_DATA_URI,
ExtensionUtils.getUriString(mContext, "http://tcset.com/images/logotcsetarriba.png"));
我該怎么辦? 我需要舉行:S謝謝!!
您需要先下載圖像,然后才能將sendImage與要替換的圖像ID和下載的位圖結合使用。 例如:
sendImage(R.id.image, bmp);
這能回答您的問題嗎?
令人難以置信,但實際上您可以在特定ImageView中顯示不是來自資源的圖像。 歸結為將圖像下載到byteArray,創建Bundle並將圖像作為Control.Intents.EXTRA_DATA傳遞。
Bundle iconBundle = new Bundle();
iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.imageView);
iconBundle.putByteArray(Control.Intents.EXTRA_DATA, buffer);
showLayout(layoutId, layoutId, layoutId, new Bundle[] {iconBundle})
我不知道為什么索尼會省略這種有用的功能。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.