Reputation: 1571
I want to display the roating images like the below shown in image one by one. How can i code in xml. I could not able to rotate image using android:rotation="20". I have to display the images like shown in image with the one on one from left to right.
Upvotes: 0
Views: 987
Reputation: 3329
public class Rotate {
public static Bitmap rotate(Bitmap src, float degree) {
// create new matrix
Matrix matrix = new Matrix();
// setup rotation degree
matrix.postRotate(degree);
// return new bitmap rotated using matrix
return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true);
}
}
Upvotes: 1
Reputation: 328
Take a look at this code
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:toDegrees="90"
android:pivotX="50%"
android:pivotY="50%"
android:drawable="@drawable/image">
</rotate>
Make sure your android:fromDegrees
is correct.
Upvotes: 0
Reputation: 292
It will be better to write method, and write in it RotateAnimation code, and pass the parameters accordingly to rotate each and every image.
Upvotes: 0