[컴][안드로이드] Animation 정리, How to use Animation

android animation 정리 / android animation 에 대해 알아보자.


on working...

Animation 종류


Resource path

  • View Animation
    • res/anim/animation_deatil.xml : Tween animation
    • res/drawable/animation_detail.xml : Frame animation
  • Property Animation
    • res/animatior/animation_detail.xml


class 종류

  • View Animation
    • Animation : Tween animation
    • AnimationDrawable : Frame Animation
  • Property Animation
    • ValueAnimator
    • ObjectAnimator
    • AnimatorSet.

Visibility 와 animation

ref. 2 처럼 해결하는 것이 가장 편리해 보인다.

원하는 View 를 extends 하고, show 와 hide 를 새롭게 정의해서 사용하면 편리하다. 그러면 Visibility 를 View.VISIBLE 로 하고나 View.INVISIBLE 로 설정할 때 animation 을 같이 넣어줄 수 있다.


Source examples


View Animation




ImageView image = (ImageView) findViewById(R.id.image);
Animation hyperspaceJump = AnimationUtils.loadAnimation(this, R.anim.hyperspace_jump);
image.startAnimation(hyperspaceJump);
Property Animation
AnimatorSet set = (AnimatorSet) AnimatorInflater.loadAnimator(myContext,
    R.anim.property_animator);
set.setTarget(myObject);
set.start();




See Also

  1. [Android] android animation 정리
  2. Android Working with XML Animations



References

  1. Developer page : Android Animation : http://developer.android.com/guide/topics/resources/animation-resource.html
  2. Android: show/hide a view using an animation - Stack Overflow

댓글 없음:

댓글 쓰기