원하는 애니메이션을 onClick 이벤트에 추가 할 수 있습니다.
1) 생성 (또는 기존의 경우 추가) 입술 디렉토리 내부의 ANIM 폴더를 넣어 slide_animation.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fillAfter="true">
<translate
android:fromXDelta="0%p"
android:toXDelta="75%p"
android:duration="800" />
</set>
2) 이미지 뷰의 온 클릭 동작이 코드를 추가
// Refer the ImageView like this
imageView = (ImageView) findViewById(R.id.imageView);
// Load the animation like this
animSlide = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.slide_animation);
// Start the animation like this
imageView.startAnimation(animSlide);
xml의 애니메이션 사양을 수정하여 원하는 효과를 얻을 수 있습니다.
그리고 AnimatorListener를 구현하면 애니메이션이 끝날 때 이미지 뷰를 닫을 수 있습니다.
animSlide.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
//remove image view from the layout
}
});