-1

当我打开应用程序时

  1. 将一张图像显示为背景
  2. 几秒钟后(自动)移动一点并显示相同的图像从右到左移动,上面有文本和可点击按钮

怎么做?

4

2 回答 2

1

您可以使用 Handler.postDelayed(); 您可以在几秒钟后使用 Runnaable 类的 run() 方法中的 setContectView 设置不同的布局,该方法用作 Handler.postDelayed() 中的参数。

前任:

new Handler.postDelayed(new Runnable() {
        public void run() {
          setContectView(R.layout.secondlayout)
        }
    }, 2000); 

这将在 2 秒后加载新布局。

于 2013-11-06T07:50:04.053 回答
1

愿这对你有帮助

   public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        //display the logo during 5 secondes,
        new CountDownTimer(5*1000,1000){
            @Override
            public void onTick(long millisUntilFinished){} 

            @Override
            public void onFinish(){
                   //set the new Content of your activity
                   YourActivity.this.setContentView(R.layout.main);
            }
       }.start();
    }
于 2013-11-06T07:58:15.300 回答