나는 활동 (예를 들어 homeActivity)을 가지고 있었고 홈 액션에서 새로운 활동 (nextActivity)을 시작할 때 맨 아래에서 나타나는 것처럼 애니메이션 효과를주고 싶다. 안드로이드에서 가능합니까?animation in 안드로이드
6
A
답변
2
Intent.FLAG_ACTIVITY_NO_ANIMATION 플래그를 사용하여 기본 애니메이션 (오른쪽에서 슬라이드)을 금지 할 수 있습니다.
즉 :
Intent myIntent = new Intent(context, MyActivity.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
context.startActivity(myIntent);
는 다음 활동에 당신은 단순히 자신의 애니메이션을 지정해야합니다.
6
startActivity
으로 전화 한 후 overridePendingTransition
의 아이디로 xml 정의 된 애니메이션, 현재 활동 용, 입력 용으로 하나씩 호출하십시오. 이 방법 here
1
TopListActivity topList;
Vector<BitmapDrawable> images;
int count = 0;
public AnimationAlphaTimer(TopListActivity _topList)
{
this.topList = _topList;
this.images = new Vector<BitmapDrawable>();
for (int i = 0; ; i++) {
// LOAD IMAGES HERE
}
if (this.images.size() > 0) {
this.topList.slide_0.setBackgroundDrawable(this.images.get(0));
if (this.images.size() > 1) {
this.topList.slide_1.setBackgroundDrawable(this.images.get(1));
}
}
this.count = 1;
}
public void launch()
{
if (this.images.size() >= 2) {
(new Timer(false)).schedule(this, 100);
}
}
@Override
public void run()
{
this.doit();
this.cancel();
}
private void doit()
{
if ((this.count % 2) == 0) {
AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);
animation.setStartOffset(3000);
animation.setDuration(3000);
animation.setFillAfter(true);
animation.setAnimationListener(this);
this.topList.slide_1.startAnimation(animation);
} else {
AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setStartOffset(3000);
animation.setDuration(3000);
animation.setFillAfter(true);
animation.setAnimationListener(this);
this.topList.slide_1.startAnimation(animation);
}
}
public void onAnimationEnd(Animation animation)
{
if ((this.count % 2) == 0) {
this.topList.slide_1.setBackgroundDrawable(
this.images.get((this.count + 1) % (this.images.size()))
);
} else {
this.topList.slide_0.setBackgroundDrawable(
this.images.get((this.count + 1) % (this.images.size()))
);
}
this.count++;
this.doit();
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationStart(Animation animation) {
}}
내가 그것을 작동합니다 생각이 시도에 대한 문서를 참조하십시오.
관련 문제
- 1. Animation in libgdx
- 2. jquery animation in firefox
- 3. onTouch 이벤트 in 안드로이드
- 4. 스트리밍 오디오 in 안드로이드
- 5. 안드로이드 onClickEvent in adapterview
- 6. 목록보기 색상 in 안드로이드
- 7. UIView animation VS core animation
- 8. 드로잉 라인 그래프 in 안드로이드
- 9. <- 연산자 in 안드로이드 그래픽
- 10. 맞춤형 디지털 시계 in 안드로이드
- 11. 검색 엔진 프로그램 in 안드로이드
- 12. play flv 비디오 in 안드로이드
- 13. 목록보기 새로 고침 in 안드로이드
- 14. editable textview in 안드로이드 위젯
- 15. 이메일 애플 리케이션 in 안드로이드
- 16. 페이지 뷰 컨트롤러 in 안드로이드
- 17. jQuery animation
- 18. UIActivityIndicatorView animation
- 19. UIImage animation
- 20. element animation
- 21. UIView animation
- 22. uibutton animation
- 23. UIImageView animation
- 24. jquery animation
- 25. javascript canvas animation
- 26. 이미지 처리 in 안드로이드, 핀치 확대 브라우저
- 27. 터치 이벤트 in 안드로이드 앱 개발
- 28. xml 레이아웃 정의 in 안드로이드 1.5
- 29. 안드로이드 ImageView image src in Style
- 30. 안드로이드 콘텐츠 공급자 쿼리 IN 절