布局:
<ImageView android:id="@+id/imt_photo" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginLeft="0dp" android:layout_marginRight="0dp" android:layout_marginTop="0dp" > </ImageView>
初始化和簡單的使用:
private ImageView imageView; imageView= (ImageView) findViewById(R.id.imt_photo); imageView.setImageBitmap(pic); // 這個ImageView是拍照完成后顯示圖片 private static String photoPath = "/sdcard/AnBo/"; private static String photoName = photoPath + "laolisb.jpg"; BitmapFactory.Options op = new BitmapFactory.Options(); op.inSampleSize = 4; // 這個數字越大,圖片大小越小,越不清晰 Bitmap pic = null; pic = BitmapFactory.decodeFile(photoName, op); //從指定的地方獲取圖片 imageView.setImageBitmap(pic); //顯示圖片信息