PopUpWindow中的EditText就像禁用一样,不接受任何输入

时间:2012-08-29 21:23:33

标签: android android-edittext popupwindow

这是我初始化popUpWindow

的地方
popUp = new PopupWindow(this);
layout = new LinearLayout(this);
mainLayout = new LinearLayout(this);
tv = new TextView(this);

ques = new EditText(this);
sol = new EditText(this);



params = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
layout.setOrientation(LinearLayout.VERTICAL);
tv.setText("Hi this is a sample text for popup window");
layout.addView(ques, params);
popUp.setContentView(layout);

这是我试图设置监听器的地方:

popUp.showAtLocation(layout, Gravity.BOTTOM, 10, 10);
popUp.update(50, 50, 300, 80);


popUp.setFocusable(true);
ques.clearFocus();
ques.addTextChangedListener(new TextWatcher() {

public void afterTextChanged(Editable s) {}
 public void beforeTextChanged(CharSequence s, int start, int count, int after) { }

 public void onTextChanged(CharSequence s, int start, int before, int count) {
                                           xx=ques.getText();
                                        }});




ques.setEnabled(true);
ques.getText();

popUp窗口显示正常,里面有一个editText,但就好像它不工作,keyBoard没有显示,如果我写得正常,它仍然显示为空白。

1 个答案:

答案 0 :(得分:2)

我有同样的问题,只需使用:

popUp.setFocusable(true);