Create a 180 degree rotation

Can I create a button or text image inside the xml LinearLayout rotated 180 degrees?

I tried animation, but the returned result returns to 0 degrees after the first round of animation. How can I solve this problem?

+6
source share
2 answers

we can create a drawable that will be rotated with any number of degrees like this .. create a drawing file like this.

<rotate xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/ic_launcher2" android:fromDegrees="180" android:toDegrees="180" android:visible="true" /> 

define this file in any accessible folder

if this file name rotates then ..

In android:background="@drawable/rotate" button android:background="@drawable/rotate"

+18
source

you can also set android: scaleY = "- 1" in xml for your button. This will flip the whole view 180 degrees by Y or change it to X scale to โ€œmirrorโ€ it, for example. Not rotation, but rotate it 180 degrees.

+4
source

Source: https://habr.com/ru/post/952035/


All Articles