Est-ce que le soutien AlertDialog WebView?
-
28-09-2019 - |
Question
Je suis en train de mettre en œuvre un AlertDialog avec l'intérieur Webview.
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" />
Cependant, je suis une erreur sur "Voir alertDialogView = inflater.inflate (R.layout.dialog_layout, null);" dire « android.view.InflateException: ligne fichier XML binaire # 6: Erreur de gonflage webView de classe "Et" 26/11 17: 15: 47,934: ERREUR / AndroidRuntime (4699): provoqué par: java.lang.ClassNotFoundException: android.view.webView dans le chargeur dalvik.system.PathClassLoader@43457e60 «
Quelqu'un peut-il sait ce qui est arrivé? Est-ce que le soutien AlertDialog WebView? Merci pour tout conseil à l'avance.
Cordialement, Chris
La solution
Vous devez écrire WebView , pas webView . Majuscules W
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow