所以我用一个网页和另一个googlemap活动制作了这个WebView应用程序,但是webview的运行速度非常慢(页面加载速度比它应该慢,滚动速度非常慢且滞后),我尝试过:
Change the page
android:hardwareAccelerated
LAYER_TYPE_SOFTWARE
LAYER_TYPE_HARDWARE
setRenderPriority(deprecated, I know)
webSET.setDatabaseEnabled(true);
webSET.setDomStorageEnabled(true);
webSET.setAppCacheEnabled(true);
webSET.setCacheMode(WebSettings.LOAD_NO_CACHE);
似乎没有任何效果。 我不明白为什么它这么慢 而且文字也很奇怪。 谷歌浏览器运行页面非常好。 一些图片: https://www.dropbox.com/sc/cgqs05pm1v4qrdr/AADFe17cWdjQnhjDOHaLjinIa
编辑:我正在尝试配置XWalk,但我遇到了问题 MainActivity.java 包com.gvglive.gvglive;import android.provider.ContactsContract;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import org.chromium.content_public.browser.WebContents;
import org.xwalk.core.XWalkPreferences;
import org.xwalk.core.XWalkView;
public class MainActivity extends ActionBarActivity {
private XWalkView mWB;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWB=(XWalkView)findViewById(R.id.mWB);
mWB.load("http://gvglive.com/", null);
}
}
AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gvglive.gvglive" >
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
activity_main.xml中
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<org.xwalk.core.XWalkView
android:id="@+id/mWB"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</RelativeLayout>
的build.gradle(模块:应用)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.gvglive.gvglive"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'org.xwalk:xwalk_core_library:12.41.296.5'
}
任何帮助都将不胜感激。