마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

중간에 애니매이션이 있는 로고액티비티를 삽입하고싶은데 잘 안되네요 ㅠㅠ

0 추천

 

처음 앱을 실행할때

중간에 로고가들어간 애니매이션을 넣고 싶은데 잘 안되네요 ㅠ

 

바로 다음 앱으로 넘어가는것이 문제인데요...

Thread.sleep(10000); 등을 이용하면 애니매이션이 멈춰버려서 문제구요 ㅠㅠ

 

 

 

관련팁이나 정보주심 정말 감사하겠습니다!!

 

애니매이션은 안드로이드에서 제공하는 animationdrawable을 사용하고있습니다!

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/selected"
    android:oneshot="false" >

    <item android:drawable="@drawable/anim_ssdam0" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam1" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam2" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam3" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam4" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam5" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam7" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam8" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam9" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam10" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam11" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam12" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam13" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam14" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam15" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam16" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam17" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam18" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam19" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam20" android:duration="66"/>

    <item android:drawable="@drawable/anim_ssdam21" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam22" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam23" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam24" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam25" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam26" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam27" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam28" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam29" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam30" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam31" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam32" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam33" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam34" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam35" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam36" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam37" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam38" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam39" android:duration="66"/>
    <item android:drawable="@drawable/anim_ssdam40" android:duration="66"/>
</animation-list>

 

bombermin (2,520 포인트) 님이 2015년 2월 11일 질문

1개의 답변

+1 추천
아래처럼 실행시켜보세요
스레드를 타기전에 실행해주시면 됩니다.
ImageView AppLodingAnimation;
        AnimationDrawable frameAnimation;

        // 로딩 효과
        AppLodingAnimation = (ImageView) findViewById(R.id.이미지뷰);

        // animation_list.xml 를 ImageView 백그라운드에 셋팅한다
        AppLodingAnimation.setBackgroundResource(R.drawable.애니메이션 xml);

        // 이미지를 동작시키기위해  AnimationDrawable 객체를 가져온다.
        frameAnimation = (AnimationDrawable) AppLodingAnimation.getBackground();

        // 애니메이션 시작
        frameAnimation.start();

 

 

하늘아륑 (16,800 포인트) 님이 2015년 2월 11일 답변
하늘아륑님 답변에 내용 추가 하자면,,
특정 안드로이드 버전이나 특정 기기에서 프레임이 정상 작동 하지 않는 경우가 있어요. 하늘 아륑님 코드에서 조금 수정하시면 됩니다.


ImageView AppLodingAnimation;
AnimationDrawable frameAnimation;
 
// 로딩 효과
AppLodingAnimation = (ImageView) findViewById(R.id.이미지뷰);
 
// animation_list.xml 를 ImageView 백그라운드에 셋팅한다
AppLodingAnimation.setBackgroundResource(R.drawable.애니메이션 xml);
 
// 이미지를 동작시키기위해  AnimationDrawable 객체를 가져온다.
frameAnimation = (AnimationDrawable) AppLodingAnimation.getBackground();
 

//프레임 애니메이션을 비동기 실행
AppLodingAnimation.post(new Runnable(){  
  @Override
  public void run() {
    // TODO Auto-generated method stub
     frameAnimation.start();
  }
});
결과적으로 코드를 이렇게 짰는데요, 여전히 애니매이션이 돌다가, 중간에서 thread가 시작되면 멈춰버리네요!! ㅠㅠㅠ 제가원하는건 액티비티1, 2, 3  이렇게 있으면 중간 2번에서 애니매이션을 실행하고 3으로 넘어가는일인데.. ㅠ 액티비티 3개를 사용하는게 문제인걸까요?ㅠ 도움부탁드려요!


 logo = (ImageView) findViewById(R.id.anim_logo);
                    logo.setBackgroundResource(R.drawable.anim_logo);

                    frame_logoanim = (AnimationDrawable) logo.getBackground();
//                    frame_logoanim.start();





                    //프레임 애니메이션을 비동기 실행
                    logo.post(new Runnable(){
                        @Override
                        public void run() {
                            // TODO Auto-generated method stub
                            frame_logoanim.start();
                        }
                    });



                    Log.d("frameAnimation31", "Thread.sleep(3000);");
                    try {
                        Thread.sleep(5000);
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
...