public setView ( android arg0 ) : global::android.app.AlertDialog.Builder | ||
arg0 | android | |
return | global::android.app.AlertDialog.Builder |
LayoutInflater inflater = LayoutInflater.FromContext(context); View dialogView = inflater.Inflate(Resource.Layout.custom_dialog_layout, null); AlertDialog.Builder builder = new AlertDialog.Builder(context) .SetTitle("Custom Dialog Example") .SetView(dialogView) .SetPositiveButton("OK", (sender, args) => {}); AlertDialog dialog = builder.Create(); dialog.Show();
LinearLayout layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; TextView title = new TextView(context); title.Text = "Custom View Example"; layout.AddView(title); EditText input = new EditText(context); layout.AddView(input); AlertDialog.Builder builder = new AlertDialog.Builder(context) .SetView(layout) .SetPositiveButton("OK", (sender, args) => {}); AlertDialog dialog = builder.Create(); dialog.Show();Here, we create a LinearLayout and add a TextView and EditText to it. We then set this layout as the content view of the AlertDialog using SetView. The package library for the Android.App.AlertDialog.Builder class is the "Mono.Android" package, which is part of the Xamarin development platform.
public setView ( android arg0 ) : global::android.app.AlertDialog.Builder | ||
arg0 | android | |
return | global::android.app.AlertDialog.Builder |