小怪兽兽
2015-05-18 07:20
采纳率: 100%
浏览 8.4k

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

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==");

}

}

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

6条回答 默认 最新

相关推荐 更多相似问题