80,362
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fff">
<LinearLayout android:id="@+id/splashscreen"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/splash"
android:scaleType = "fitXY"
/>
</LinearLayout>
<WebView android:id="@+id/webView"
android:layout_height = "fill_parent"
android:layout_width = "fill_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:background="#fff"
android:scaleType = "fitXY"
android:visibility="gone"
/>
</LinearLayout>
@Override
public void onPageFinished(WebView view, String url) {
System.out.println("onPageFinished");
staus = 1;
super.onPageFinished(view, url);
}
//handler线程控制splash
private Handler splashHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case STOPSPLASH:
System.out.println("handleMessage");
if( staus == 1 ){
splash.startAnimation(animGo);
sendEmptyMessageDelayed(CLEARSPLISH, 3000);
break;
}
sendEmptyMessageDelayed(STOPSPLASH, SPLASHTIME);
break;
case CLEARSPLISH:
splash.setVisibility(View.GONE);
System.out.println("splash had gone");
mWebView.setVisibility(View.VISIBLE);
mWebView.requestFocus();
getFlash();
break;
case THENETCONN:
System.out.println("NETCONN==>" + NETCONN);
if(NETCONN){
unregisterReceiver(netChange);
getFlash();
break;
}
else{
sendEmptyMessageDelayed(THENETCONN, SPLASHTIME);
break;
}
}
super.handleMessage(msg);
}
};