Android帧动画仅播放第一帧

Android帧动画仅播放第一帧,android,Android,启动emulator时,动画仅播放动画的第一帧,在计时器持续时间内静止,然后启动活动 这是我的可绘制xml <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true"> <item android:drawable="@drawable/title1" a

启动emulator时,动画仅播放动画的第一帧,在计时器持续时间内静止,然后启动活动

这是我的可绘制xml

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/title1" android:duration="200" />
<item android:drawable="@drawable/title2" android:duration="200" />
<item android:drawable="@drawable/title3" android:duration="200" />
<item android:drawable="@drawable/title4" android:duration="200" />
<item android:drawable="@drawable/title5" android:duration="200" />
<item android:drawable="@drawable/title6" android:duration="200" />
<item android:drawable="@drawable/title7" android:duration="200" />
<item android:drawable="@drawable/title8" android:duration="200" />
<item android:drawable="@drawable/title9" android:duration="200" />
<item android:drawable="@drawable/title10" android:duration="200" />
<item android:drawable="@drawable/title11" android:duration="200" />
</animation-list>

这是我的布局xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
 >

<ImageView
android:id="@+id/gyro"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
 />

这是我的java文件

 public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    // Start the animation (looped playback by default).
    ImageView splash = (ImageView) findViewById(R.id.gyro);
    splash.setBackgroundResource(R.drawable.title);
    AnimationDrawable splashAnimation = (AnimationDrawable) splash.getBackground();
    splashAnimation.start();


    Thread logoTimer = new Thread(){
        public void run(){
        try{
        int logoTimer = 0;
            while(logoTimer <10000){
            sleep(100);
            logoTimer = logoTimer + 100;
            }//end of while loop
            //mpsplash.stop();
            startActivity(new Intent("tv.bScienceFiction.scrip.or.scrap.CLEARSCREEN"));
            } catch (InterruptedException e) {
                //TODO Auto-generated catch block
                e.printStackTrace();
            }

        finally{
            finish();
        }//end of finally

        }//end of run

    };//end of new Thread
    logoTimer.start();
}
public void onCreate(Bundle savedInstanceState){
requestWindowFeature(窗口。功能\u无\u标题);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_全屏,WindowManager.LayoutParams.FLAG_全屏);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
//启动动画(默认情况下为循环播放)。
ImageView splash=(ImageView)findViewById(R.id.gyro);
splash.setBackgroundResource(R.drawable.title);
AnimationDrawable splashAnimation=(AnimationDrawable)splash.getBackground();
splashAnimation.start();
线程logoTimer=新线程(){
公开募捐{
试一试{
int logoTimer=0;

而(logoTimer在退出
onCreate后从UI线程启动它

   splash.postDelayed(new Runnable() {
      public void run() {
         splashAnimation.start();
      }
   }, 200);

你太棒了。效果非常好。谢谢。我一直在用脑袋撞墙。我能找到的每一个教程都没有提到这一点。谢谢。如果这个解决方案对你有效,请将它标记为“已接受”-这将帮助其他人找到它,如果他们有同样的问题