android - 如何让 android 程序显示布局,然后等待几秒钟。并显示另一种布局?

标签 android layout timer wait

大家好,我只想让程序显示布局 main0 并停留几秒,然后显示布局 main1,就像我们在任何手机中看到的程序一样,在程序开始时显示图像或布局,然后淡出。

/**the main activity */

public class rdwt extends Activity implements OnClickListener{

Button b1;
Button b2;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main0);
    //Here
    setContentView(R.layout.main1);

    b1= (Button)findViewById(R.id.Button01);
    b2= (Button)findViewById(R.id.Button02);
    b1.setOnClickListener(this);
    b2.setOnClickListener(this);


}

    public void onClick(View v) {
        if (v==this.b1){
            Intent callwrite = new Intent(this, wto.class);              
            startActivity(callwrite);
        }

        if(v==this.b2){
            Intent callread = new Intent(this, rfr.class);               
            startActivity(callread);
        }

    }

最佳答案

您需要阅读有关 Updating the UI from a Timer 的技术文章

关于android - 如何让 android 程序显示布局,然后等待几秒钟。并显示另一种布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3321818/

相关文章:

jquery - 如何使 jQuery Sticky Float 插件对页面更改做出实时 react ?

html - 带有 css 的阿拉伯语 HTML 布局方向

php - Javascript 计时器的准确性

android - 在 Android Studio 中引用其他模块中的 .apk 类

java - 抽屉布局应用程序的架构

android - SQLite 创建具有唯一列组合的表

安卓 : Switch (ToggleButton) and threads

jakarta-ee - 使用有状态 ejb 的 TimerService 的解决方法

c# - 订阅后事件触发

android - 无需用户交互即可在我的 apk 中下载 Apk