0
我用tabhost创建了android应用程序。在这个应用程序中,我有4个选项卡,每个选项卡都包含其独立的webview。对于这个应用程序,我想在加载标签栏的webview之前为应用程序添加SplashScreen。我怎样才能做到这一点?Android标签栏应用程序的启动屏幕
我用tabhost创建了android应用程序。在这个应用程序中,我有4个选项卡,每个选项卡都包含其独立的webview。对于这个应用程序,我想在加载标签栏的webview之前为应用程序添加SplashScreen。我怎样才能做到这一点?Android标签栏应用程序的启动屏幕
创建一个不同的活动来显示将作为启动器活动的启动画面。发动你可以从这个活动开始后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();
}
}
希望它能帮助。
我正在使用以下代码在主要活动中创建选项卡栏。 addTabBar(本); \t \t \t \t \t addTabItem(“file:///android_asset/WebApplication/GetContacts.html”,“View1”,null); \t \t \t \t \t \t \t \t addTabItem( “文件:///android_asset/WebApplication/AddContact.html”, “视图2”,NULL); \t \t \t \t \t \t \t \t addTabItem( “文件:///android_asset/WebApplication/GetContacts.html”, “View4”,NULL);这些方法用于创建选项卡栏并加载web视图。通过这种创建webview的方式,我如何添加启动画面? – Karthick
如果我在onPageStarted()和onPageFinished()方法中显示并隐藏启动画面,则启动画面将在第一个选项卡webview中加载 – Karthick
对此有什么要求吗? – Karthick