简体   繁体   中英

How to hide keyboard when touching on the EditText in Android Studio

i'm new to this forum, this is my first question ever !!!

I'm having an project making a calculator on Android using Android Studio 1.1.0.

The problem is how can I hide the keyboard on the EditText (but still keep the cursor display) ???

Thanks everyone !!!

Well you can use this :- InputMethodManager input = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); input.hideSoftInputFromWindow(EditText1.getWindowToken(), 0); InputMethodManager input = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); input.hideSoftInputFromWindow(EditText1.getWindowToken(), 0); where editText1 is the name of the textfield for inputs..... It will hide the keyboard and you can use the buttons to get the numbers in the editText for your calculator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM