我有4.2.2平板电脑和6.0.1电话。当我在平板电脑上显示webview时,它不像下面那样。
但是电话是正确的,如下所示。
布局与:
相同<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/layMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<WebView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webView"
android:layout_gravity="center_horizontal" />
代码:
private void startWebView(String url) {
webView.setWebViewClient(new WebViewClient() {
ProgressDialog progressDialog;
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
public void onLoadResource (WebView view, String url) {
if (progressDialog == null) {
progressDialog = new ProgressDialog(KentRehberiActivity.this);
progressDialog.setMessage("Harita Getiriliyor...");
progressDialog.show();
}
}
public void onPageFinished(WebView view, String url) {
try{
if (progressDialog != null) {
if (progressDialog.isShowing()) {
progressDialog.dismiss();
progressDialog = null;
}
}
}catch(Exception exception){
exception.printStackTrace();
}
}
});
为什么平板电脑的屏幕不正确?