У меня есть вид изображения, в котором я хотел бы показать картинку из URI в телефонеAndroid Matrix postRotation не работает
Я хочу, чтобы повернуть Bitmap моего изображения в соответствии с ориентацией оно было принято в - но он не работает, всегда показывайте картинку с той же ориентацией.
Это мой ImageView:
<!-- picture imageView -->
<ImageView
android:id="@+id/fragment_new_picture_imageview_picture"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:contentDescription="@string/app_name"
android:scaleType="fitXY" />
Это моя матричная функция:
/**
* Get the new picture {@link Bitmap} according to picture's right orientation
* @return the picture's {@link Bitmap}
*/
public Bitmap getPictureBitmap()
{
//if there is a saved instance - return it
if (pictureBitmap != null)
return pictureBitmap;
//decode bitmap
Bitmap bitmap = BitmapFactory.decodeFile(path);
//rotate bitmap
Matrix matrix = new Matrix();
matrix.postRotate(orientation);
//create new rotated bitmap
bitmap = Bitmap.createBitmap(bitmap, 0, 0,bitmap.getWidth(), bitmap.getHeight(), matrix, true);
return bitmap;
}
И это, как моя активность упоминается в манифесте:
<activity
android:name="com.coapps.pico.background.BackgroundActivity"
android:screenOrientation="portrait"
android:theme="@style/MainActivityTheme" >
</activity>
ориентации задаются с помощью запросов к Media.EXTERNAL_CONTENT_URI и получить поле Media_ORIENTATION
Где и как устанавливается «ориентация»? Какое значение оно имеет, когда вы вызываете 'postRotate()'? – Simon
просто используйте scaleType = "matrix" для вас ImageView – pskink
Я получаю его из таблицы изображений systen. это и путь из таблицы ... но проблема в том, что независимо от того, что я установил в качестве ориентации, он не меняет –