Keyboard hide event with BACK key

后端 未结 5 950
野的像风
野的像风 2020-12-30 13:19

I\'ve noticed in the Android Market Application, when you click over the search button, it shows the keyboard, but when you click the back button,

5条回答
  •  攒了一身酷
    2020-12-30 13:36

    Hey i think the market app is using the googleSearch dialog (check out Searcheable activity ).

    You can implement the editText in a popupWindow, and set the poupwindow as focusable. Show the keyboard when your popup is shown. in onDismiss hide the keyboard.

    popupWindow.setFocusable(true);
    popupWindow.setOnDismissListener(new OnDismissListener() {
    
            @Override
            public void onDismiss() {
                // TODO Auto-generated method stub
                inputMethodManager.hideSoftInputFromWindow(
                            edttxtSearchBar.getWindowToken(), 0);           }
    

    This will ensure, you click anywhere outside popup or press back the popup disappears as well(along with keyboard).

提交回复
热议问题