Antonio
Antonio

Reputation: 1231

Create drawable rotate 180 degree

Is possible to create a button or textview inside of xml LinearLayout rotated 180 degrees?

I tried the animation but the drawable return to 0 degree after the first circle of animation. How might I address this issue?

Upvotes: 14

Views: 12620

Answers (2)

kalyan pvs
kalyan pvs

Reputation: 14590

we can create a drawable that is rotated of any number of degree like this..create a drawable 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 the any drawable folder

if this file name is rotate then..

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

Upvotes: 34

jimbob
jimbob

Reputation: 3298

you could also set the android:scaleY="-1" in the xml for your button. That would flip the whole view 180 degrees by the Y or change it to scale X to "mirror" it for example. Not a rotation but would flip it 180 degrees for sure.

Upvotes: 7

Related Questions