简体   繁体   English

在Android Studio中触摸EditText时如何隐藏键盘

[英]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. 我有一个使用Android Studio 1.1.0在Android上制作计算器的项目。

The problem is how can I hide the keyboard on the EditText (but still keep the cursor display) ??? 问题是如何隐藏键盘在EditText上(但仍保持光标显示)

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); 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. 其中editText1是输入文本字段的名称.....它将隐藏键盘,您可以使用按钮在editText中获取计算器的数字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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