Mono for Android基本的弹提示框事件

Button btnOK = FindViewById<Button>(Resource.Id.ok);
            btnOK.Click += (sender, e) =>
            {
                EditText entry = FindViewById<EditText>(Resource.Id.entry);
                EditText entry2 = FindViewById<EditText>(Resource.Id.entry2);
                AlertDialog.Builder dlg = new AlertDialog.Builder(this);
                dlg.SetTitle("提示");
                dlg.SetMessage(string.Format("你输入的账号是:{0},密码是:{1}", entry.Text, entry2.Text));
                dlg.SetPositiveButton("确定", delegate{ });
                dlg.Show();
            };

            Button delOK = FindViewById<Button>(Resource.Id.del);
            delOK.Click += new EventHandler(delOK_Click);

       

 

 

        void delOK_Click(object sender, EventArgs e)
        {
            EditText entry = FindViewById<EditText>(Resource.Id.entry);
            EditText entry2 = FindViewById<EditText>(Resource.Id.entry2);
            entry.Text = "";
            entry2.Text = "";
        }

 

 

 

页面:

 <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="账号:" />
        <EditText
            android:id="@+id/entry"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/label" />
        <TextView
            android:id="@+id/label2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/entry"
            android:text="密码:" />
        <EditText
            android:id="@+id/entry2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/label2"
            android:password="true" />
        <Button
            android:id="@+id/ok"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/entry2"
            android:layout_alignParentRight="true"
            android:layout_marginLeft="10dip"
            android:text="OK" />
        <Button
            android:id="@+id/del"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toLeftOf="@id/ok"
            android:layout_alignTop="@id/ok"
            android:text="Cancel" />
    </RelativeLayout>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值