Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 680
Kriti Sharan Avatar asked Mar 04 '16 12:03

Kriti Sharan


People also ask

What happens when Android screen rotates?

When you rotate your device and the screen changes orientation, Android usually destroys your application's existing Activities and Fragments and recreates them . Android does this so that your application can reload resources based on the new configuration.

How do you handle rotation on Android?

If you want to manually handle orientation changes in your app you must declare the "orientation" , "screenSize" , and "screenLayout" values in the android:configChanges attributes. You can declare multiple configuration values in the attribute by separating them with a pipe | character.

How do you change orientation when retaining data?

Another most common solution to dealing with orientation changes by setting the android:configChanges flag on your Activity in AndroidManifest. xml. Using this attribute your Activities won't be recreated and all your views and data will still be there after orientation change.


1 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.

like image 196
IntelliJ Amiya Avatar answered Oct 28 '22 11:10

IntelliJ Amiya