안드로이드
[Android] 애니메이션 효과?(회전) 주기
IT꿈나무
2021. 7. 20. 17:33
반응형
목적:
안드로이드 애니메이션 효과 주기. AnimationUtils을 이용한다.
res.anim.rotate_test.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
android:duration="1500"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:repeatMode="restart"
android:fromDegrees="0"
android:toDegrees="360" />
</set>
MainActivity.xml
setContentView(R.layout.activity_main);
TextView textView = findViewById(R.id.tvHello);
Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_test);
textView.startAnimation(animation);
프로젝트 첨부:
참고 자료:
[1] https://developer.android.com/guide/topics/graphics/view-animation?hl=ko#kotlin
[2] https://jhshjs.tistory.com/45
반응형