简体   繁体   中英

EditText doesn't show keyboard on move

I have an edittext which I am moving vertically when the user drags it with his finger. 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);

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