How to hide the keyboard in Xamarin Android after clicking on the Appearance button

I am working on Xamarin (Android) . Now I want to hide the keyboard after clicking on the Edit Text button.

Thanks at Advance.

 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); } 
+5
source share
1 answer

Use this code to hide the Keyboard .

 public override bool OnTouchEvent(MotionEvent e) { InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(Etusername.WindowToken, 0); return base.OnTouchEvent(e); } 

and make sure you have to add this library:

 using Android.Views.InputMethods; 
+5
source

All Articles