Reputation: 6258
I need to rotate a wheel image, bigger than screen (that's a must).
The problem is that the android:scaleType="center" is necessary to display a image bigger than screen without being scaled, and this same tag crops the image when rotated (see screenshot below)
Here is the code of my layout :
<ImageView
android:id="@+id/wheel_img"
android:scaleType="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/wheel_test" />
my activity :
ImageView wheel_img = (ImageView) findViewById(R.id.wheel_img);
wheel_img.startAnimation(AnimationUtils.loadAnimation(this, R.anim.rotation));
and the anim/rotation.xml
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromDegrees="0"
android:toDegrees="30"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="true"
android:duration="2000" />
Any idea how to solve this problem? This is quite urgent actually!
Thanks in advance!
Upvotes: 3
Views: 1107
Reputation: 1722
adding your view inside scroll-view does the trick
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center" >
<ImageView
android:id="@+id/iv_light_streak"
android:layout_width="500dp"
android:layout_height="500dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:src="@drawable/wheel_test" />
</LinearLayout>
</ScrollView>
Upvotes: 0
Reputation: 1317
This is the trick that I use
use framelayout
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/wheel_image"
android:layout_width="image width"
android:layout_height="image height"
android:src="@drawable/wheel_test"
android:layout_gravity="center" />
works like a charm.
and that's my first contribution here. hope it works with you
Upvotes: 4