u010419167
小怪兽兽
2015-05-18 07:20

android webview加载包含一张图片的url显示空白

  • 前端开发
  • webview
  • android

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    WebView webview = (WebView) findViewById(R.id.webView1);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.setWebViewClient(new WebViewClient(){
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            // TODO Auto-generated method stub
            view.loadUrl(url);
            return false;
        }
        @Override
        public void onReceivedSslError(WebView view,
                SslErrorHandler handler, SslError error) {
            // TODO Auto-generated method stub
            handler.proceed();
        }
    });
    webview.loadUrl("http://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQFz7zoAAAAAAAAAASxodHRwOi8vd2VpeGluLnFxLmNvbS9xL2lrTUV5c1BsVWNrb0dOLUh6RzNxAAIEh3xZVQMEWAIAAA==");

}

}

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

5条回答