http://developerlife.com/tutorials/?p=343
가입일 다음은 슬라이드에서 왼쪽으로의 애니메이션입니다 (보기의 너비를 가로 질러 오른쪽에서 왼쪽으로). "/res/anim/slide_right.xml" : 여기
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
<translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="150" />
</set>
위의 하나 사용하는 다른 애니메이션 시퀀스입니다 (@의 ANIM/slide_right.xml -> "/res/anim/slide_right.xml") :
<?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:delay="10%"
android:order="reverse"
android:animation="@anim/slide_right" />
그래서 당신이 만들 수는 시퀀스를 XML로 저장하고 Android 프로젝트 리소스의 "/res/anim/some_file.xml"에 넣습니다. 이 XML 파일을 만드는 방법에 대한 자세한 내용은 여기를 참조하십시오.
또한 코드하여이 작업을 수행 할 수 있습니다 : 다음
AnimationSet set = new AnimationSet(true);
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(100);
set.addAnimation(animation);
animation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f
);
animation.setDuration(500);
set.addAnimation(animation);
LayoutAnimationController controller =
new LayoutAnimationController(set, 0.25f);
button.setLayoutAnimation(controller);
과 :
public static Animation runSlideAnimationOn(Activity ctx, View target) {
Animation animation = AnimationUtils.loadAnimation(ctx,
android.R.anim.slide_right);
target.startAnimation(animation);
return animation;
}
당신을 감사합니다! 이게 많이 도움이 될거야. –