3
A
回答
6
有很多方法可以實現您的請求。基本上你必須用urlrequest下載圖像,然後使用InputStream創建一個Bitmap對象。
只是一個示例代碼:
URL url = new URL("http://asd.jpg");
URLConnection conn = url.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
Bitmap bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
後,你獲得你可以用它在你的ImageView例如
3
只是另一種方法的位圖對象從URL下載圖像
try {
Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL("http://abc.com/image.jpg").getContent());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
相關問題
- 1. 如何在inkcanvas外部顯示圖像
- 2. 如何顯示外部圖像到textview?
- 3. 在外部鏈接中顯示圖像
- 4. 如何在SSRS中顯示外部圖像?
- 5. 如何在MVC中顯示外部圖像3
- 6. 外部圖像不顯示在Apache下
- 7. android:如何在textview中顯示圖像
- 8. 如何在ListView中顯示圖像android
- 9. 如何在android中顯示圖像組
- 10. 如何在Android中顯示大圖像
- 11. 如何在android中顯示gif圖像?
- 12. Android:如何在ListView中顯示圖像?
- 13. 如何在android中顯示bmp圖像
- 14. 如何在android中顯示.jpg圖像?
- 15. 如何在webview android中顯示圖像?
- 16. 如何在android中的對話框外顯示圖像?
- 17. 如何從外部項目目錄中顯示圖像
- 18. SSRS - 如何根據列中的URL顯示外部圖像
- 19. 如何在半外部的操作欄上顯示圖像
- 20. Android小部件圖像中的Android顯示圖像
- 21. 如何在Android中顯示座位圖像,如下圖所示?
- 22. 如何使圖像顯示在Android
- 23. ASP.NET rdlc與外部圖像不顯示PDF中的圖像
- 24. 在android xml中顯示外部光標
- 25. 如何顯示android小部件背景中的圖像?
- 26. 如何延遲的圖像顯示與外部JavaScript
- 27. 如何裁剪和顯示特定大小的外部圖像?
- 28. Android WebView圖像部分顯示
- 29. 如何在類圖中顯示我正在使用外部API
- 30. Android中的圖像顯示