Android选项卡栏应用程序的启动屏幕

Android选项卡栏应用程序的启动屏幕,android,android-webview,splash-screen,Android,Android Webview,Splash Screen,我已经用tabhost创建了android应用程序。在这个应用程序中,我有4个选项卡,每个选项卡都包含各自的webview。对于这个应用程序,我想在加载选项卡栏的webview之前为应用程序添加SplashScreen。我如何才能做到这一点?创建一个不同的活动来显示启动程序活动的启动。启动后,您可以从此活动启动tabhost public class SplashScreen extends Activity { // time for splashscreen protecte

我已经用tabhost创建了android应用程序。在这个应用程序中,我有4个选项卡,每个选项卡都包含各自的webview。对于这个应用程序,我想在加载选项卡栏的webview之前为应用程序添加SplashScreen。我如何才能做到这一点?

创建一个不同的活动来显示启动程序活动的启动。启动后,您可以从此活动启动tabhost

public class SplashScreen extends Activity {
    // time for splashscreen
    protected int _splashTime = 5000;

    private Thread splashTread;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);

        final SplashScreen sPlashScreen = this;

        // thread for displaying the SplashScreen
        splashTread = new Thread() {
            @Override
            public void run() {
                try {
                    synchronized (this) {

                        // wait 5 sec
                        wait(_splashTime);
                    }

                } catch (InterruptedException e) {
                } finally {


                    // Go to Main activity
                    Intent i = new Intent();
                    i.setClass(sPlashScreen, MainActivity.class);
                    startActivity(i);
                    finish();


                }
            }
        };

        splashTread.start();
    }


}

希望有帮助。

我正在使用以下代码在mainactivity中创建选项卡栏。addTabBar(本);addTabItem(“file:///android_asset/WebApplication/GetContacts.html“,”视图1“,空);addTabItem(“file:///android_asset/WebApplication/AddContact.html“,”视图2“,空);addTabItem(“file:///android_asset/WebApplication/GetContacts.html“,”视图4“,空);这些方法用于创建选项卡栏和加载webview。在创建webview的这种方式中,我如何添加初始屏幕?如果我在onPageStarted()和onPageFinished()方法中显示和隐藏初始屏幕,初始屏幕将加载到webview的第一个选项卡中是否有此建议?