是否AlertDialog支持的WebView? [英] Does AlertDialog support WebView?

查看:1294
本文介绍了是否AlertDialog支持的WebView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现一个AlertDialog与web视图里面。

I am trying to implement a AlertDialog with a Webview inside.

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号线:错误充气类web视图 和11-26 17:15:47.934:ERROR / AndroidRuntime(4699):抛出java.lang.ClassNotFoundException:产生的原因android.view.webView装载机dalvik.system.PathClassLoader@43457e60

However, I got an error at "View alertDialogView = inflater.inflate(R.layout.dialog_layout, null);" say "android.view.InflateException: Binary XML file line #6: Error inflating class webView " and "11-26 17:15:47.934: ERROR/AndroidRuntime(4699): Caused by: java.lang.ClassNotFoundException: android.view.webView in loader dalvik.system.PathClassLoader@43457e60 "

任何人都可以知道什么事?是否AlertDialog支持的WebView?感谢您事先的任何建议。

Can anyone knows whats happened? Does AlertDialog support WebView? Thank you for any advice in advance.

干杯, 克里斯

推荐答案

您需要编写的的WebView ,不是 web视图。大写的是W

You need to write WebView, not webView. Uppercase W

这篇关于是否AlertDialog支持的WebView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆