Android 旋转后,ImageView中的位图将被裁剪

Android 旋转后,ImageView中的位图将被裁剪,android,bitmap,rotation,Android,Bitmap,Rotation,我的Android项目中有一个ImageView。在某些情况下,我需要旋转这个图像视图。所有旋转都在旋转动画的帮助下执行。但是,当图像视图旋转90度或270度以下时,其内部的位图将在顶部和底部进行裁剪。我不知道为什么会这样。有谁能给我一个建议,如何避免这种行为 final ImageView photoView = (ImageView) main_activity.findViewById(R.id.photo_view); RotateAni

我的Android项目中有一个ImageView。在某些情况下,我需要旋转这个图像视图。所有旋转都在旋转动画的帮助下执行。但是,当图像视图旋转90度或270度以下时,其内部的位图将在顶部和底部进行裁剪。我不知道为什么会这样。有谁能给我一个建议,如何避免这种行为

            final ImageView photoView = (ImageView)  main_activity.findViewById(R.id.photo_view);
            RotateAnimation mRotateAnim = new RotateAnimation(oldRotation, newRotation, photoView.getPivotX(), photoView.getPivotY());
            mRotateAnim.setDuration(500);
            mRotateAnim.setFillAfter(true);
            photoView.startAnimation(mRotateAnim);
这是我在xml文件中的ImageView声明:

<ImageView
           android:id="@+id/photo_view"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:layout_centerInParent="true"
           android:layout_above="@+id/bottom_container"
           android:adjustViewBounds="true"/>

尝试更改

RotateAnimation mRotateAnim = new RotateAnimation(oldRotation, newRotation, photoView.getPivotX(), photoView.getPivotY());
与:


谢谢你的建议,但是这个解决方案对我没有帮助?
RotateAnimation mRotateAnim = new RotateAnimation(oldRotation, newRotation, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);