use*_*445 5 c# java 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
Run Code Online (Sandbox Code Playgroud)