I try to make the image file rotate in place and try my best, every tutorial that I find does it differently.
Can someone point out where I am not here.
Gameplay.java
import android.app.Activity; import android.graphics.drawable.AnimationDrawable; import android.os.Bundle; import android.widget.ImageView; public class GamePlay extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gameplay); ImageView logo = (ImageView)findViewById(R.id.mainlogo); logo.setBackgroundResource(R.anim.rotate); AnimationDrawable frameAnimation = (AnimationDrawable) logo.getBackground(); frameAnimation.start(); } }
rotate.xml
<?xml version="1.0" encoding="UTF-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0" android:toDegrees="360" android:drawable="@drawable/logo" />
gameplay.xml
<ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/mainlogo" android:src="@drawable/logo"> </ImageView>
source share