0

我这里有我的启动画面的代码,但是当我在进入主游戏时将启动画面放在我的程序上时似乎是错误的,有人可以帮忙吗?谢谢!

这是我的代码:

        public class SpalshScreenActivity extends Activity {
         public void onAttachedToWindow() {
                super.onAttachedToWindow();
                Window window = getWindow();
                window.setFormat(PixelFormat.RGBA_8888);
            }


        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.splash);
            StartAnimations();

        }

        private void StartAnimations() {
            Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
            anim.reset();
            LinearLayout l=(LinearLayout) findViewById(R.id.lin_lay);
            l.clearAnimation();
            l.startAnimation(anim);

            anim = AnimationUtils.loadAnimation(this, R.anim.translate);
            anim.reset();
            ImageView iv = (ImageView) findViewById(R.id.logo);
            iv.clearAnimation();
            iv.startAnimation(anim);

            anim = AnimationUtils.loadAnimation(this, R.anim.translatez);
            anim.reset();
            ImageView ib = (ImageView) findViewById(R.id.logo2);
            ib.clearAnimation();
            ib.startAnimation(anim);}

            protected Class<? extends Activity> getFollowUpActivity() {
                return BodyPartsGameActivity.class;
            }
    }
4

1 回答 1

1

如果您的问题是“为什么它没有从启动屏幕进展到下一个活动”......您永远不会发出命令。为什么你认为在正常的 Activity 上有一个 getFollowUpActivity 会被调用?

您需要一个专门的 Activity 或使用线程在特定时间后将您的 splasscreen 转发到主屏幕。

于 2012-07-19T08:00:19.873 回答