Webview错误API 19如下

时间:2016-11-23 07:32:57

标签: android android-webview

我在Android应用中有一个webview。我在webview中显示了一个地图页面。 当我在API 23中显示webview时,它是正确的视图。但是,当我显示API< 19时,它不是正确的视图。我尝试了很多方法,但它是不成功的。我要做。你也可以试试。 建立gradle api级别:14

API 23: enter image description here

API 17: enter image description here

活动类:

public class KentRehberiActivity extends AbstractVatandasActivity{
WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.kent_rehberi_layout);

    LinearLayout layKentRehberiKategoriList=(LinearLayout)findViewById(R.id.layKentRehberiKategoriList);
    webView=(WebView)findViewById(R.id.webView);

    layKentRehberiKategoriList.setVisibility(View.GONE);
    webView.setVisibility(View.VISIBLE);
    startWebView(SingletonClass.getAyarlar().getKentRehberiUrl());
}

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();
                    }
                }
            }catch(Exception exception){
                exception.printStackTrace();
            }
        }
    });
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(url);
}}

0 个答案:

没有答案