我點擊一個按鈕打開相機應用程序。並在下一個活動中顯示拍攝的照片。但拍攝的照片旋轉90度。當我在捕獲圖像後在視圖中顯示圖像時,它的方向始終是風景。爲什麼在縱向模式下拍攝照片時照片不會以縱向顯示?捕獲的照片方向正在改變android
的onClick按鈕:
Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(APP_DIR+"/latest.png")));
startActivityForResult(i, CAPTURE_PHOTO_CONSTANT);
內onActvityresult:
bmp = BitmapFactory.decodeFile(APP_DIR+"/latest.png");
startActivity(new Intent(this, DisplayActivity.class));
顯示拍攝的照片:
photoViewRelativeLayout.setBackgroundDrawable(new BitmapDrawable(getResources(), CaptureActivity.bmp));
可能重複([爲什麼使用相機意圖拍攝圖像被在機器人某些設備旋轉] http://stackoverflow.com/questions/14066038/why-image-captured-using-camera -intent-gets-rotated-on-some-devices-in-android) – bummi
在這裏回答http://stackoverflow.com/questions/14066038/why-image-captured-using-camera-intent-gets-rotated-on- some-devices-in-android –