简体   繁体   中英

Issue with android keypad popping up

I am developing an android application using fragments. I have a fragment that contains a list that holds some values. when I click on an item in the list view, it get redirected to another fragment. I have an Edit Text in that fragment. When I press on that edit text keypad pops up.

Now my issue is that when I go backs to the previous fragment with out minimizing the keypad, the keyboards stats in the previous fragment also.

How can I remove the keypad when I moves back to the first screen?

You force fully hide Key Board in Fragment like

   InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);                     
   imm.hideSoftInputFromWindow(getView().getWindowToken(), 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