简体   繁体   English

EditText在移动时不显示键盘

[英]EditText doesn't show keyboard on move

I have an edittext which I am moving vertically when the user drags it with his finger. 我有一个edittext,当用户用手指拖动它时,它会垂直移动。 However I don't want that the keyboard opens when I lift the finger off the view after dragging. 但是,我不希望在拖动后将手指从视图上抬起时打开键盘。

How can I do this? 我怎样才能做到这一点? Here is my code so far: 到目前为止,这是我的代码:

case MotionEvent.ACTION_MOVE:
            getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);               
            v.animate().y(event.getRawY() + dY).setDuration(0).start();
            break;

This will hide the keyboard: 这将隐藏键盘:

InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);

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

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