Вопрос

Я пытаюсь реализовать 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" />

Тем не менее, я получил ошибку в «View AlertDialogView = Influble.inflate (r.layout.dialog_layout, null);" Скажи "android.view.inflateException: бинарный XML-файл # 6: ошибка накаляет класс WebView" и "11-26 17: 15: 47.934: ошибка / androidruntime (4699): вызвано: java.lang.classnotfoundException: Android.View .webview в погрузчике dalvik.system.pathclassloader @43457e60 "

Кто-нибудь может знать, что случилось? Поддерживает ли AlertDialog WebView? Спасибо за любой совет заранее.

Ура, Крис

Это было полезно?

Решение

Вам нужно написать WebView., нет WebView.. Отказ Верхний регистр Варенье

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top