1. 애니메이션 시퀀스 설정 파일 생성 - res/anim/rotate.xml
<!-- 시계방향으로 5초간 회전 / pivotX, pivotY : 회전축의 anchor point -->
<rotate android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="100%"
android:pivotY="100%"
android:duration="5000" />
<rotate android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="100%"
android:pivotY="100%"
android:duration="5000" />
2. 이미지에 애니메이션 적용
// 이미지 표시
ImageView myImage = (ImageView)findViewById(R.id.ImageView01);
myImage.setImageResource(R.drawable.cook);
// 애니메이션 적용
Animation an = AnimationUtils.loadAnimation(this, R.anim.rotate);
myImage.startAnimation(an);
ImageView myImage = (ImageView)findViewById(R.id.ImageView01);
myImage.setImageResource(R.drawable.cook);
// 애니메이션 적용
Animation an = AnimationUtils.loadAnimation(this, R.anim.rotate);
myImage.startAnimation(an);
반응형
'Program > Android Java' 카테고리의 다른 글
안드로이드 - Alert Dialog (0) | 2012.06.12 |
---|---|
안드로이드 - OptionMenu : 단말기 Menu 버튼 클릭하면 나오는 메뉴 (0) | 2012.06.12 |
안드로이드 - Resource 형식과 저장 위치 (0) | 2012.06.12 |
안드로이드 - 웹에있는 mp3 플레이 하기 (0) | 2012.06.12 |
[android] C2DM을 이용한 push notification (0) | 2012.06.12 |