Android - imageView عرض الصورة من المعرض في "المناظر الطبيعية"
سؤال
أولا على الإطلاق، ربما "المناظر الطبيعية" ليست كلمة أفضل لوصفها، لكنني لا أستطيع التفكير في واحدة أخرى في الوقت الحالي.
أنا أستخدم التعليمات البرمجية التالية لإظهار صورة في صورة ImageView، ولكن صورتي التي تم التقاطها مع الجهاز في "صورة" (الرأس "(الرأس" (الرأس) يظهر Sidelong.
الرمز الخاص بي: giveacodicetagpre.
xml: giveacodicetagpre.
ونعم، "المحتوى: // الوسائط / الخارجية / الصور / الوسائط / 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
لا تنتمي إلى StackOverflow