xamarin.android 警告对话框(AlterDialog)

1.普通的警示对话框:

var dialog = new AlertDialog.Builder(this);
dialog.SetTitle("This is title");
dialog.SetMessage("This is message...");
//设置警告对话框的按钮
dialog.SetPositiveButton("Close",delegate
{
    //操作
});
dialog.Show();

2.单选警示对话框: 

int singleCheck = -1;
string[] items = new string[] { "1", "2", "3" };
using (var dialog = new AlertDialog.Builder(this))
    {
        dialog.SetTitle("title");
        dialog.SetPositiveButton("ok", delegate
            {
                Toast.MakeText(this, "" + singleCheck, ToastLength.Long).Show();
            });
        dialog.SetSingleChoiceItems(items, singleCheck,(s, e1) => 
            {
                var index = e1.Which;
                singleCheck = index;
            });
        dialog.Show();
    }

 

你可能感兴趣的:(xamarin.android)