Android:旋转时,应该超出视图边界的图像正在被裁剪
我的一个活动中有一个ImageView。它包含具有“中心”scaleType属性的方形分辨率图像。我有一个中心固定点无限旋转的图像。然而,在旋转时,它会被裁剪到创建时的大小。我会试着画一些图片来说明我的意思。看看下面这些 编辑:我忘了添加一些代码,很抱歉 XML:Android:旋转时,应该超出视图边界的图像正在被裁剪,android,animation,rotation,imageview,Android,Animation,Rotation,Imageview,我的一个活动中有一个ImageView。它包含具有“中心”scaleType属性的方形分辨率图像。我有一个中心固定点无限旋转的图像。然而,在旋转时,它会被裁剪到创建时的大小。我会试着画一些图片来说明我的意思。看看下面这些 编辑:我忘了添加一些代码,很抱歉 XML: <ImageView android:id="@+id/SunAndMoon" android:layout_width="match_parent" android:layout
<ImageView android:id="@+id/SunAndMoon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:scaleType="center"
android:src="@drawable/sunandmoon"/>
Animation timeofday = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.timeofdayrotation);
timeofday.setRepeatCount(Animation.INFINITE);
findViewById(R.id.SunAndMoon).startAnimation(timeofday);
试试这个:
<ImageView android:id="@+id/SunAndMoon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:src="@drawable/sunandmoon"/>
试试这个:
<ImageView android:id="@+id/SunAndMoon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:src="@drawable/sunandmoon"/>