I'm trying to rotate the image 360 by clicking it myself, but it doesn't work
I am using an xml file like this.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView android:id="@+id/imageView1" android:layout_width="72dp" android:layout_height="72dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="83dp" android:layout_marginTop="103dp" android:clickable="true" android:src="@drawable/cute" /> </RelativeLayout>
and java code like this ...
package com.example.testapplication; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.animation.RotateAnimation; import android.widget.ImageButton; public class MainActivity extends Activity implements OnClickListener { ImageButton img; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); img = (ImageButton) findViewById(R.id.imageView1); } public void onClick(View v) {
My purpose of the application is to use 9 img btn development and puzzle games.
source share