문제

전혀, 어쩌면 "풍경"은 더 좋은 단어가 아니라 더 좋은 단어가 아닙니다. 그러나 나는 그 순간에 또 다른 것을 생각할 수 없습니다.

ImageView에서 이미지를 표시하려면 다음 코드를 사용하고 있지만 "초상화"(머리 위로)에서 장치로 촬영 한 이미지는 Sidelong을 보여줍니다.

내 코드 :

mImageView  = (ImageView) findViewById(R.id.iv_photo);

Uri u = Uri.parse("content://media/external/images/media/7");
mImageView.setImageURI(u);
.

XML :

<ImageView
    android:id="@+id/iv_photo"
    android:layout_width="wrap_content"          
    android:layout_height="wrap_content"/>
.

및 yes, "content : // media / external / image / media / 7"은 유효한 경로입니다.

아이디어가 있습니까?

도움이 되었습니까?

해결책

Just check the image's dimensions, if it's taller than it is wider, then you can rotate it:
http://android-er.blogspot.com/2010/07/rotate-bitmap-image-using-matrix.html

The relevant bits are:

  bitmap = BitmapFactory.decodeFile(imageInSD);
  bmpWidth = bitmap.getWidth();
  bmpHeight = bitmap.getHeight();

  Matrix matrix = new Matrix();
  matrix.postScale(curScale, curScale);
  matrix.postRotate(curRotate);

  Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bmpWidth, bmpHeight, matrix, true);
  myImageView.setImageBitmap(resizedBitmap);

다른 팁

android:id="@+id/iv_photo"

android:layout_width="320dip"   

android:layout_height="wrap_content"/>

Use this it may works

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top