android–AlertDialog是否支持WebView?

android–AlertDialog是否支持WebView?,第1张

概述我正在尝试使用Webview实现AlertDialog.publicOnClickListenerimageButtonViewOnClickListener=newOnClickListener(){publicvoidonClick(Viewv){LayoutInflaterinflater=LayoutInflater.from(MyActivity.this);//errorhereViewalertDialogVie

我正在尝试使用WebvIEw实现AlertDialog.

public OnClickListener imagebuttonVIEwOnClickListener = new OnClickListener() {public voID onClick(VIEw v) {    LayoutInflater inflater = LayoutInflater.from(MyActivity.this);    // error here    VIEw alertDialogVIEw = inflater.inflate(R.layout.alert_dialog_layout, null);    WebVIEw myWebVIEw = (WebVIEw) findVIEwByID(R.ID.DialogWebVIEw);    myWebVIEw.loadData(webContent, "text/HTML", "utf-8");    AlertDialog.Builder builder = new AlertDialog.Builder(MyActivity.this);    builder.setVIEw(alertDialogVIEw);    builder.setPositivebutton("OK", new DialogInterface.OnClickListener() {        public voID onClick(DialogInterface dialog, int which) {            dialog.cancel();        }    }).show();}

};

<linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content"androID:orIEntation="vertical"><webVIEw androID:ID="@+ID/DialogWebVIEw" androID:layout_height="wrap_content"    androID:layout_wIDth="fill_parent" androID:layout_marginleft="20dip"    androID:layout_marginRight="20dip" androID:textAppearance="?androID:attr/textAppearanceMedium" />

 

但是,我在“查看alertDialogVIEw = inflater.inflate(R.layout.dialog_layout,null)”时收到错误;“说“androID.vIEw.InflateException:二进制XML文件行#6:错误膨胀类webVIEw
“和”11-26 17:15:47.934:ERROR / AndroIDRuntime(4699):引起:java.lang.classNotFoundException:androID.vIEw.webVIEw in loader dalvik.system.PathClassLoader@43457e60

有人知道发生了什么事吗? AlertDialog是否支持WebVIEw?提前感谢您的任何建议.

干杯,
克里斯

解决方法:

您需要编写WebVIEw,而不是webVIEw.大写字母W.

总结

以上是内存溢出为你收集整理的android – AlertDialog是否支持WebView?全部内容,希望文章能够帮你解决android – AlertDialog是否支持WebView?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1113946.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存