我是Android应用程序中的新手,这是我的第一个应用程序。 我已经创建了启动画面和工程..但其后走了一个长长的白色空白屏幕约2-5秒,然后URL开始加载..Android Webview:加载url时出现闪屏

而我的问题是..如何使一些加载或进度加载网址时在启动画面中显示吧?所以没有更多的白色黑屏。对不起,我的英语不好。

的AndroidManifest.xml

package="com.xxx.xxx" >

android:allowBackup="true"

android:icon="@drawable/ic_launcher"

android:label="xxx"

android:theme="@style/AppTheme"

android:hardwareAccelerated="true" />

android:name="com.xxx.xxx.Splash"

android:label="xxx"

android:theme="@style/Theme.MyAppTheme" >

android:name=".MyActivity"

android:hardwareAccelerated="true"

android:configChanges="orientation|screenSize"

android:label="xxx" >

activity_my.xml

xmlns:tools="http://schemas.android.com/tools"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

tools:context=".MyActivity">

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:id="@+id/webView"

android:layout_gravity="center"

/>

android:id="@+id/display"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:visibility="gone"

/>

android:id="@+id/customViewContainer"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:visibility="gone"/>

Splash.java

import android.app.Activity;

import android.content.Intent;

import android.os.Bundle;

import android.os.Handler;

public class Splash extends Activity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.splashscreen);

final Handler handel = new Handler();

handel.postDelayed(new Runnable() {

@Override

public void run() {

// TODO Auto-generated method stub

Intent loadSplash = new Intent(Splash.this, MyActivity.class);

startActivity(loadSplash);

finish();

}

}, 3000);

}

}

splashscreen.xml

xmlns:tools="http://schemas.android.com/tools"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#ffffff" >

android:id="@+id/imageView1"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:src="@drawable/splash" />

2014-10-27

z4bl3nk

+0

[初始屏幕而在Android应用一个网页视图加载URL](HTTP的可能的复制:// stackoverflow.com/questions/9589365/splash-screen-while-loading-a-url-in-a-webview-in-android-app) –

2016-03-26 20:56:12

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐