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.

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.

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.

Now, run your application which will look like this.

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

Post a Comment

Powered by Blogger.