小编raj*_*aji的帖子

如何在单击Edittext外部后在Xamarin Android中隐藏键盘

我正在研究Xamarin(Android).现在我想在外面点击后隐藏键盘Edit Text.

提前致谢.

public class MainActivity : Activity
{


    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        // Set our view from the "main" layout resource
        RequestWindowFeature(WindowFeatures.NoTitle);


        SetContentView(Resource.Layout.Main);

        EditText Etusername= FindViewById<EditText>(Resource.Id.EtUname);
        Etusername.SetHintTextColor(Color.Gray);

        InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
        imm.HideSoftInputFromWindow(Etusername.WindowToken, 0);
    }
Run Code Online (Sandbox Code Playgroud)

c# android xamarin.android android-softkeyboard

5
推荐指数
1
解决办法
9783
查看次数