1. 程式人生 > >android設定本地圖片到imageview

android設定本地圖片到imageview

通過將圖片路徑轉換成為bitmap 或者uri,然後設定到控制元件上

String s = Environment.getExternalStorageDirectory().getAbsolutePath() + "/downdown/123.jpg";

        Bitmap bitmap = BitmapFactory.decodeFile(s);
        mImageview.setImageBitmap(bitmap);

        
        Uri uri = Uri.fromFile(new File(s));

        mImageview.setImageURI(uri);