在 EditText 上输入后隐藏关键字
To Hide Keyword after input on EditText
我在 edittext 中输入了 phone 数字。然后我想去下一个视图,因为下一个视图被关键字隐藏了,所以我怎么能隐藏这个,在这种情况下,我该如何处理呢?
enter image description here
在您完成输入并单击回车按钮后隐藏软键盘。
Textview.setOnEditorActionListener(new TextView.OnEditorActionListener()
{
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
//your content
}
/*This code will basically hide the keyboard*/
InputMethodManager imm =
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
return false;
}
});
在此代码中,当您完成输入后,用户将按下回车键,键盘将隐藏软键盘。
我在 edittext 中输入了 phone 数字。然后我想去下一个视图,因为下一个视图被关键字隐藏了,所以我怎么能隐藏这个,在这种情况下,我该如何处理呢?
enter image description here
在您完成输入并单击回车按钮后隐藏软键盘。
Textview.setOnEditorActionListener(new TextView.OnEditorActionListener()
{
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
//your content
}
/*This code will basically hide the keyboard*/
InputMethodManager imm =
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
return false;
}
});
在此代码中,当您完成输入后,用户将按下回车键,键盘将隐藏软键盘。