In
res/anim/rotate_anim.xml
:<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="-90"
android:pivotX="50%"
android:pivotY="50%"
android:duration="0" />
Java Code
Button b = (Button) findViewById(R.id.pageBack);
RotateAnimation ranim = (RotateAnimation) AnimationUtils.loadAnimation(this, R.anim.rotatie_anim);
ranim.setFillAfter(true); //For the button to remain at the same place after the rotation
b.setAnimation(ranim);
沒有留言:
張貼留言