--ADVERTISEMENT--

In android, you can easily draw a line in drawer file and rotate it. In this example, I will show how to rotate a line in android using xml drawable. To draw and rotate a line, first of all create a xml drawable file in drawable directory and link it in your xml activity like the following example.

Related:
How to Rotate an Image in Android
Get Current Time in Android Programmatically
How to Set Android Button and TextView Border Color

Android Example: How to Rotate a Line in Android


Drawable Resource File
res/drawable/line_rotate_drawable.xml

XML Layout File
This layout contains a view and set background to the above xml drawable file.
res/layout/line_rotate.xml

Java Activity File
Following is the default java code of MainActivity.java file.
src/MainActivity.java

Output:

How to Rotate a Line in Android
Rotate a Line in Android

Post a Comment

Powered by Blogger.