Java 图像翻转并没有';t刻度

Java 图像翻转并没有';t刻度,java,android,Java,Android,我有一个imageView,它将图像逆时针旋转90度,图像不会填满屏幕 我有一个imageviewer.xml,定义为: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/LinearLayout01" xmlns:android="http://schemas.android.com/apk/res/android" android

我有一个imageView,它将图像逆时针旋转90度,图像不会填满屏幕

我有一个imageviewer.xml,定义为:

    <?xml version="1.0" encoding="utf-8"?>

    <LinearLayout 
      android:id="@+id/LinearLayout01"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical">

<ImageView
    android:id="@+id/image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
 </LinearLayout>
但是,当图像显示在活动中时,它会逆时针旋转90度,不会像预期的那样填满整个屏幕——即使我在运行应用程序之前在同一台设备上以纵向模式拍摄了这张照片


有人知道出了什么问题或可能出了什么问题吗

您需要使用
setImageMatrix
旋转和缩放图像

您还应该将图像scaletype设置为
MATRIX

//you need a matrix
Matrix matrix = new Matrix();

// set the scale
matrix.postScale(scaleWidth, scaleHeight);

// rotate the Bitmap
matrix.postRotate(90);

// then apply it
img.setImageMatrix(matrix);
这方面有一个很好的例子

更新

根据问题发起者的评论,可以在


从上到下还是从左到右翻转?你是说轮换吗?逆时针方向?我的意思是旋转-其逆时针方向:/n如果你将照片保存到电脑上,它是否也以同样的方式旋转?是的。你知道我该怎么转吗?谢谢。。在您的帮助和本文的帮助下,我终于实现了位图的旋转
//you need a matrix
Matrix matrix = new Matrix();

// set the scale
matrix.postScale(scaleWidth, scaleHeight);

// rotate the Bitmap
matrix.postRotate(90);

// then apply it
img.setImageMatrix(matrix);