В My Layout есть EditText для поиска, и есть список под EditText.Now, я раздуваю этот макет в PopupWindow. Теперь моя проблемаPopupWindow не отбрасывает на back key
1) Если я установил PopupWindow focusable true, тогда все места, кроме PopupWindow Layout, становятся неактивными. Так что я не могу уволить окно, нажав на него или нажав кнопку «Назад» устройство
2) Если я установил PopupWindow фокусируемые ложно, то Popupwindow открывается и закрывается идеально, но мягкая клавиатура не становится видимой на отводе EditText
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// Inflate the view from a predefined XML layout View layout = inflater.inflate(R.layout.popup_layout, null);
mPopUpWindow= new PopupWindow(layout,0, mScreenHeight - 100, false);
mPopUpWindow.setBackgroundDrawable(null);
mPopUpWindow.setOutsideTouchable(true);
mPopUpWindow.setTouchInterceptor(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
mPopUpWindow.dismiss();
}
return false;
}
});
final InputMethodManager inputMgr = (InputMethodManager) MainApplication.getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
inputMgr.showSoftInput(mEditText, InputMethodManager.SHOW_IMPLICIT);
mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
inputMgr.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
return true;
}
return false;
}
});
Не могли бы вы вставить здесь какой-то код, чтобы мы могли увидеть, где проблема, или дать вам подсказку о том, как ее преодолеть? – g00dy