Search code examples
androidzxing

How to rotate TextView


I'm using Zxing bar code scanner in an application and I want to change the text in the scanner view to appear at the right side instead of at the bottom. The scanner view is set to horizontal view, i don't want to change that. I just want to rotate the textView containing the help text so it will appear on the right. Any suggestions?


Solution

  • First create a folder like this res/anim/rotate.xml and, give below code,

    <rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="0" android:toDegrees="360" android:toYScale="0.0"
    android:pivotX="40%" android:pivotY="30%" android:duration="2000" />
    

    This code can be rotate your TextView. You can modify this. And, see this aritcle also.

    Rotating TextView Using Animation

    Hope this can be of help you.