Loading...

How to Rotate an Image in Android

In this example, you will learn to rotate an image in android. In android, there are lots of method to rotate an image using XML and java, but here I am using a java method to rotate an image. Following is the simple example of rotating an image in android.

Related:
How to Rotate a Line in Android
How to Make a Phone Call in Android

Android Example: Rotate an Image in Android


XML Layout File
Add an ImageView in your xml layout file and give it an id.
res/layout/rotate_image.xml

Java Activity File
To rotate an image, you have to add a little bit java code in your activity file after which MainActivity.java file looks like this.
src/MainActivity.java

Now, run your application which will look like this.

How to Rotate an Image in Android
Rotate an Image in Android

Tutorial 3027798372812281571
Home item