【发布时间】:2014-06-06 18:25:10
【问题描述】:
我想在 webview 中获取 html 图片并显示到 imageview。
我不想要一个解决方案以及图片下载的 URL。
我尝试了以下方法。
public class WebViewClientFix extends WebViewClient
{
private Bitmap bmpCaptcha;
private Context context;
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler,SslError error)
{
handler.proceed();
}
@Override
public void onPageFinished(WebView view, String url)
{
super.onPageFinished(view, url);
}
@Override
public void onLoadResource(WebView view, String url)
{
super.onLoadResource(view, url);
}
public Bitmap getBmpCaptcha()
{
return bmpCaptcha;
}
public void setBmpCaptcha(Bitmap bmpCaptcha)
{
this.bmpCaptcha = bmpCaptcha;
}
public Context getContext() {
return context;
}
public void setContext(Context context) {
this.context = context;
}
}
和
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webview = (WebView)findViewById(R.id.webView1);
imageView = (ImageView)findViewById(R.id.imageView1);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setAllowFileAccess(true);
webview.getSettings().setAppCacheEnabled(true);
webview.getSettings().setLoadsImagesAutomatically(true);
webClinent = new WebViewClientFix();
webClinent.setContext(this);
webview.setWebViewClient(webClinent);
webview.loadUrl("https://xxxxx.tr/login");
}
我应该如何遵循解决方案?
谢谢
【问题讨论】:
-
什么是“html 图片”?您正在通过 http 加载一些资源,大概是一些 html 页面;你在说什么图片?
-
喜欢
-
我不明白 WebView 的用途。
-
我将esgm.sgk.gov.tr/Esgm/LoginT.action 的url 与webview 连接起来。我想处理验证码图像并显示图像视图。
标签: android parsing webview imageview captcha