안드로이드 개발 질문/답변
(글 수 45,052)
public class GraphicActivity extends Activity {private ImageView image01;
private Button btn_click;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);
setContentView(R.layout.main);
image01 = (ImageView)findViewById(R.id.test_image);
btn_click = (Button)findViewById(R.id.click);
final Animation animation = AnimationUtils.loadAnimation(this, R.anim.effect_01);
AnimationSet set = new AnimationSet(true);
set.setInterpolator(new AccelerateInterpolator());
set.setRepeatMode(Animation.RESTART);
set.setRepeatCount(Animation.INFINITE);
image01.startAnimation(animation);
btn_click.setOnClickListener(new View.OnClickListener() {@Override
public void onClick(View v) {// TODO Auto-generated method stub
image01.startAnimation(animation);
}
});
}
}
안녕하세요 animation에 대해 공부하고 있는데요. rotate와 translate 2개의 동작을 하는 set을 만들어서
제가 만든어 놓은 Button 클릭 시 그 에니메이션셋의 동작을 하도록 만들었는데요.
한번만 동작하는건 잘되는데.. setRepeatCount써서 제가 몇번반복하라고 정의하던지, INFINITE하게 반복하라고 해도
한번만 동작하고 멈추네요. 어떻게 처리해야 할까요?
조언부탁드립니다!!^^
2010.06.15 11:26:18
왜 그런지 모르겠는데-
<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false">
<translate android:fromXDelta="0" android:toXDelta="100%" android:duration="1000"
android:repeatMode="reverse" android:repeatCount="infinite"/>
<translate android:fromXDelta="100%" android:toXDelta="0" android:duration="1000" />
</set>
이렇게 해놓으면 무한반복됩니다.



