본문 바로가기

나의 플랫폼/안드로이드

[Android] setCustomAnimations 이 동작하지 않을때

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Fragment 이동할 시, setCustomAnimations 함수를 이용하여 커스텀하게 Animation을 주게 됩니다.

이때 설정은 분명 잘 한것 같은데 동작을 잘 하지 않지요.


혹시 아래와 같이 설정하시지 않았나요?

FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
transaction.replace(R.id.main_container_, new NoticeFragment());
transaction.addToBackStack(null);
transaction.commit();


그럼 한번 setCustomAnimations 함수를 아래와 같이 매개 변수를 추가해서 설정해보세요.


FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.anim.fade_in, R.anim.fade_out,R.anim.fade_in, R.anim.fade_out);
transaction.replace(R.id.main_container_, new NoticeFragment());
transaction.addToBackStack(null);
transaction.commit();


3번째와 4번째가 popEnter,popExit 로 BackStack이 될 때 이용되는 애니메이션이라고 하네요.

참고하세요.


http://stackoverflow.com/questions/6993863/fragmenttransation-setcustomanimations-not-working