슬라이딩 패널에서 찾은 코드를 사용했지만 기본적으로 작동하지만 작은 문제가 있습니다.TranslateAnimation - 애니메이션은 두 번째 시간 이후에만 작동합니다.
패널이 처음 열리면 애니메이션이 작동하지 않습니다.
TranslateAnimation anim = null;
m_isOpen = !m_isOpen;
if (m_isOpen) {
setVisibility(View.VISIBLE);
anim = new TranslateAnimation(0.0f, 0.0f, getHeight(), 0.0f);
} else {
anim = new TranslateAnimation(0.0f, 0.0f, 0.0f, getHeight());
anim.setAnimationListener(new Animation.AnimationListener() {
public void onAnimationEnd(Animation animation) {
setVisibility(View.GONE);
}
public void onAnimationRepeat(Animation animation) {
// not needed
}
public void onAnimationStart(Animation animation) {
// not needed
}
});
}
anim.setDuration(300);
anim.setInterpolator(new AccelerateInterpolator(1.0f));
startAnimation(anim);
왜 먼저 내가 어떤 애니메이션 만이 다른 모든 사람이 없다 패널을 엽니 다에 :
여기에 애니메이션의 코드인가?
확실하지 않습니까? 몇 가지 로그를 넣으십시오. Mabye는 패널이 아직 표시되지 않거나보기를 만들 때 시작됩니다. – ania
작동하지 않습니다. 처음 열 때만 애니메이션이 열리고 닫히는 데 모두 작동합니다. – piojo
일종의 해결책을 찾았습니다. 패널의 가시성을 GONE으로 설정하는 대신 앱이 – piojo