我正在尝试显示PopupWindow
代码如下:
// initialize a pop up window type
PopupWindow popupWindow = new PopupWindow(view,
view.getLayoutParams().WRAP_CONTENT,
view.getLayoutParams().WRAP_CONTENT, false);
// the drop down list is a list view
RecyclerView listView = new RecyclerView(mContext);
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
listView.setLayoutManager(layoutManager);
// set our adapter and pass our pop up window contents
listView.setAdapter(new TaggingAdapter(mContext, users, callback));
// some other visual settings
popupWindow.setFocusable(true);
//view.requestFocus();
popupWindow.setWidth(Utility.dpToPx(mContext.getResources(), 250));
popupWindow.setHeight(Utility.dpToPx(mContext.getResources(), 200));
// set the list view as pop up window content
popupWindow.setContentView(listView);
它确实起作用,但是,它使edittext
不可编辑。如果我删除了focus
,那么在编辑editText
之后,popupWindow
就会消失。即使编辑了popupWindow
或除非手动将其关闭,如何使edittext
保持可用状态。