I have TextView which is rotating, but I want to rotate only the background of TextView not a text, I tried to put TextView inside the LinearLayout but still it is rotating with text, so how can I solve this?
My xml code is below:
<TextView
android:id="@+id/txtRotate"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignBottom="@+id/gif1"
android:layout_centerHorizontal="true"
android:background="@drawable/round_image"
android:text="Hello"
android:textColor="@android:color/holo_red_dark"
android:gravity="center" />
MainActivity.java
animFadein = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.rotate);
animFadein.setFillAfter(true);
animFadein.setAnimationListener(this);
txtVibrate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
txtRotate.startAnimation(animFadein);
}
});
rotate.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:duration="6000"
android:repeatMode="restart"
android:repeatCount="0"
android:interpolator="@android:anim/cycle_interpolator"/>
</set>