Home » Android » How does android:rotationX and android:rotationY in XML actually work?

How does android:rotationX and android:rotationY in XML actually work?

Posted by: admin June 16, 2020 Leave a comment

Questions:

The function’s parameters are float as stated in the android documentation but then why does the following not work:

<LinearLayout
        android:orientation="vertical"
        android:layout_width="4sp"
        android:layout_height="280sp"
        android:background="#F44336"
        android:rotationX="45.0"
        android:id="@+id/Dstrike1"/>

This just displays the original line in the centre of the parent view.
Screenshot of the display

Although to obtain a diagonal line on the screen android.animation can be used, is there a simpler method?

How to&Answers:
public static final int rotationX

Added in API level 11 .rotation of the view around the x axis, in
degrees.

You did’t get it on Preview section .When you will run the app you will see this at the VM.