Android - 旋转ImageView但宽度/高度不变?

时间:2016-06-04 17:06:06

标签: java c# android xamarin

如何在旋转时让ImageView更新它的宽度/高度?

如果我有以下ImageView和调试,宽度为827,高度为543.旋转后,宽度/高度保持不变,导致动画出现问题。

图像在屏幕上正确旋转,但我希望更新ImageView尺寸(宽度= 543,高度= 827)。

<ImageView
    android:id="@+id/imageView2"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_width="wrap_content"
    android:layout_centerInParent="false"
    android:src="@drawable/img"
    android:adjustViewBounds="true"
    android:padding="0dp"
    android:background="@android:color/transparent"
    android:visibility="visible"
    android:layout_centerVertical="false" />

    _img = FindViewById<ImageView>(Resource.Id.imageView2); //width = 827, height = 543
    _img.Rotation = -90;
// width is still 827 and height is still 543 

0 个答案:

没有答案