当前位置: 首页>>代码示例>>C#>>正文


C# TextView.ClearFocus方法代码示例

本文整理汇总了C#中Android.Widget.TextView.ClearFocus方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.ClearFocus方法的具体用法?C# TextView.ClearFocus怎么用?C# TextView.ClearFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Widget.TextView的用法示例。


在下文中一共展示了TextView.ClearFocus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState)
        {
            base.OnCreateView (inflater, container, savedInstanceState);

            var view = inflater.Inflate (Resource.Layout.LogInDialog, container, false);

            mTxtUserName = view.FindViewById<EditText> (Resource.Id.txtUserName);
            mTxtPassword = view.FindViewById<EditText> (Resource.Id.txtPassword);

            mCheckbox = view.FindViewById<CheckBox> (Resource.Id.LoginCheckBox);

            try{
                var CheckPrefs = Application.Context.GetSharedPreferences("MyCheckState", FileCreationMode.Private);
                checkState = CheckPrefs.GetString("CheckState", null);

            }catch{

            }

            switch (checkState)
            {
            case "False":
                mCheckbox.Checked = false;
                break;
            case "True":
                mCheckbox.Checked = true;
                try{
                    var UsernamePrefs = Application.Context.GetSharedPreferences("username", FileCreationMode.Private);
                    mTxtUserName.Text = UsernamePrefs.GetString("username", null);

                }catch{

                }
                try{
                    var PasswordPrefs = Application.Context.GetSharedPreferences("password", FileCreationMode.Private);
                    mTxtPassword.Text = PasswordPrefs.GetString("password", null);

                }catch{

                }
                break;
            default:
                mCheckbox.Checked = true;
                break;
            }

            mBtnSignUp = view.FindViewById<Button> (Resource.Id.btnLogInDialog);
            mErrorText = view.FindViewById<TextView> (Resource.Id.txtError);

            mProgressBar = view.FindViewById<ProgressBar> (Resource.Id.progressBar);

            mProgressBar.Visibility = ViewStates.Invisible;

            mBtnSignUp.Click +=  (object sender, EventArgs e) => {

                mProgressBar.Visibility = ViewStates.Visible;

                mTxtUserName.ClearFocus();
                mErrorText.ClearFocus();
                mBtnSignUp.RequestFocus();

                mErrorText.Text=string.Format("登录中...");

                //关键盘

                InputMethodManager inputManager = (InputMethodManager)Activity.GetSystemService(Context.InputMethodService);

                inputManager.HideSoftInputFromWindow(mTxtPassword.WindowToken, HideSoftInputFlags.None);
                inputManager.HideSoftInputFromWindow(mTxtUserName.WindowToken, HideSoftInputFlags.None);

                mWorker=new BackgroundWorker();
                mWorker.WorkerSupportsCancellation = true;

                mWorker.DoWork+= delegate(object sender1, DoWorkEventArgs e1) {

                    BackgroundWorker mworker = sender1 as BackgroundWorker;

                    if (mworker.CancellationPending == true) {
                        e1.Cancel = true;
                    } else {
                        checkPassword();
                    }

                };

                mWorker.RunWorkerCompleted+=delegate(object sender1, RunWorkerCompletedEventArgs e1) {

                    if (e1.Cancelled == true) {

                    } else if (!(e1.Error == null)) {

                    } else {
                        worker_RunWorkerCompleted();
                    }

                };

                if (mWorker.IsBusy != true) {
                    mWorker.RunWorkerAsync ();
                }
//.........这里部分代码省略.........
开发者ID:coroner4817,项目名称:ShangShuiXiaoFang,代码行数:101,代码来源:logInDialogCreate.cs


注:本文中的Android.Widget.TextView.ClearFocus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。