Xamarin.Android AlertDialog中的EditText打上去字为什么不显示?也没有光标闪烁

AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetTitle("请您输入管理员密码");
            View v = LayoutInflater.From(this.ApplicationContext).Inflate(Resource.Layout.Item_alert_dialog, null);
            EditText edi_admin_pwd =v.FindViewById<EditText>(Resource.Id.edi_admin_pwd);
            builder.SetView(v);
            builder.SetNegativeButton("确认",(der, eve)=>
            {
                if (edi_admin_pwd.Text == "123456")
                {
                    Java.Lang.JavaSystem.Exit(0);
                }
                else
                {
                    this.ApplicationContext.MessagesShow("密码错误!");
                    MyMediaPlayer.GetInstance(this).Error();
                }
            });
            builder.SetPositiveButton("取消", (der,eve)=> { });
            builder.Create();
            builder.Show();

 

 

解决了 把getApplicationContext()改成this即可

http://bbs.csdn.net/topics/391069045

posted @ 2017-12-24 22:17  LuoCore  阅读(747)  评论(0编辑  收藏  举报