이미지 한장을 불러와서 회전 시키고 싶은데요
rotate버튼을 눌러도 아무런 응답이 없습니다.
아래 코드 잘못된 부분 지적좀 해주세요 ㅜㅜ
package main.sandglass;
import android.app.*;
import android.graphics.drawable.*;
import android.os.*;
import android.view.*;
import android.view.View.OnClickListener;
import android.view.animation.*;
import android.widget.*;
public class FrameAni extends Activity {
int value = 0;
AnimationDrawable mAni;
OnClickListener mClickListener;
LinearLayout mLinear;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.draw_frameani);
ImageView img = (ImageView)findViewById(R.id.count);
mAni = (AnimationDrawable)img.getBackground();
CountDownTimer mTimer;
mLinear = (LinearLayout)findViewById(R.id.linear);
findViewById(R.id.rotate).setOnClickListener(mClickListener);
Button.OnClickListener mClickListener = new View.OnClickListener() {
public void onClick(View v) {
Animation ani = null;
ani = AnimationUtils.loadAnimation(FrameAni.this, R.anim.rotate);
mLinear.startAnimation(ani);
}
};
Button btn = (Button)findViewById(R.id.start);
btn.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
mAni.start();
new CountDownTimer(64000, 1000) {
public void onTick(long millisUntilFinished) {
value++;
if( value == 61) {
mAni.stop();
}
}
public void onFinish() {
}
}.start();
}
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id ="@+id/linear"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/count"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/frame"
android:layout_gravity="center_horizontal"
android:layout_weight="4"
/>
<Button
android:id="@+id/start"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Start "
android:layout_weight="1"
/>
<Button
android:id="@+id/rotate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="rotate"
android:layout_weight="1"
/>
</LinearLayout>