我有一个要求,在编辑框中输入文本后,然后单击虚拟键盘 DONE(EditorInfo.IME_ACTION_DONE) 现在光标不可见 [我正在使用 editText.setCursorVisible(false)]。现在问题又是我单击编辑框光标不可见,但文本正在进入编辑框。
谢谢
我有一个要求,在编辑框中输入文本后,然后单击虚拟键盘 DONE(EditorInfo.IME_ACTION_DONE) 现在光标不可见 [我正在使用 editText.setCursorVisible(false)]。现在问题又是我单击编辑框光标不可见,但文本正在进入编辑框。
谢谢
我通过使用解决了它
edittext.setFocusableInTouchMode(true);//this brought back my cursor after setting focusable false.
代替
edittext.setFocusable(true);
您需要在 EditText 的 onClick 侦听器中再次设置光标可见。
在您的 edittext onClick 侦听器中尝试这两种方法。
edittext.setFocusable(true);
edittext.setCursorVisible(true);
这应该可以解决您的问题。
将此属性放在 edittext 小部件中。
android:cursorVisible="false"
然后将此代码放在 mainactivity 的 oncreate() 中。
Edittext searchView;
searchView=(EditText)findViewById(R.id.editText);
searchView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
searchView.setCursorVisible(true);
return false;
}
});
注意::我已经为期货查询写了这个。希望这是我认为这个 qs 不需要的。
也许使视图无效?
editText.invalidate()