【发布时间】:2011-03-22 06:01:44
【问题描述】:
我似乎无法在整个屏幕上正确旋转图像。问题是当图像旋转时,您可以在某些区域看到背景。我希望图像在旋转时也能填满屏幕。这是布局。我尝试了不同的比例类型,但没有成功。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop" />
</LinearLayout>
这是我正在使用的代码。
image = (ImageView) findViewById(R.id.image);
image.setBackgroundResource(R.drawable.back_big);
rot = AnimationUtils.loadAnimation(this, R.anim.rotation);
image.startAnimation(rot);
我在onResume 中开始动画。正如我所说,图像会旋转,但旋转时会有背景区域。我尝试过使用比屏幕大得多的图像,但它仍然没有达到我想要的效果。我不在乎图像的外部区域不可见。我只是想让旋转填满屏幕。我猜ImageView 最初设置它的宽度和高度,然后,当它旋转时,它使用这些尺寸。有没有更好的方法来做到这一点?
【问题讨论】:
标签: android animation rotation