當前位置:編程學習大全網 - 網站源碼 - android開發 為什麽圖片無法顯示,源代碼如下

android開發 為什麽圖片無法顯示,源代碼如下

妳可以講網絡圖片獲取後存放到本地文件夾 然後獲取該文件的路徑 進行讀取

String sdpath="/sdcard/file/";

String path="/sdcard/file/"+圖片名字+".png";

BitmapFactory.Options opts = new BitmapFactory.Options();

opts.inJustDecodeBounds = true;

BitmapFactory.decodeFile(path, opts);

opts.inSampleSize = computeSampleSize(opts, -1, 240*240);

opts.inJustDecodeBounds = false;

Bitmap bm = BitmapFactory.decodeFile(path, opts);

appItem.mAppIcon.setImageBitmap(bm);

截取的部分代碼資料 可以借鑒下下...

  • 上一篇:發送位置的源代碼
  • 下一篇:如何完成婺源手遊合夥人的任務?
  • copyright 2024編程學習大全網