我用tabhost创建了android应用程序。在这个应用程序中,我有4个选项卡,每个选项卡包含其单独的webview。对于这个应用程序,我想在加载标签栏的webview之前为应用程序添加SplashScreen。我怎样才能做到这一点?
答案 0 :(得分:1)
创建一个不同的活动来显示将成为您的启动器活动的启动。启动后,您可以从此活动
启动tabhost答案 1 :(得分:1)
试试这个
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();
}
}
希望它有所帮助。