EditText无法打开键盘

时间:2013-03-13 19:04:00

标签: android android-edittext android-softkeyboard

我的EditText etDetailsNOteetTitleNote打开键盘进行打字。请建议我可以改变什么。我在这里找不到任何错误。

popUpAddNote = new PopupWindow(this);
mainLayout = new LinearLayout(this);
etTitleNote = new EditText(this);
etDetailsNOte = new EditText(this);
bAdd = new Button(this);

bAddNewNote.setOnClickListener(new OnClickListener() {

    public void onClick(View v) {
        if (click) {
            popUpAddNote.showAtLocation(mainLayout,Gravity.CENTER, 10, 10);
            popUpAddNote.update(50, 50, 250, 200);
            click = false;
        } else {
            popUpAddNote.dismiss();
            click = true;
        }
    }
});

params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
mainLayout.setOrientation(LinearLayout.VERTICAL);
etTitleNote.setHint("Title");
etTitleNote.setWidth(250);
mainLayout.addView(etTitleNote,params);
etDetailsNOte.setHint("Details");
etDetailsNOte.setInputType(InputType.TYPE_CLASS_TEXT
        | InputType.TYPE_TEXT_VARIATION_PASSWORD);
etDetailsNOte.setWidth(250);
etDetailsNOte.setHeight(150);
mainLayout.addView(etDetailsNOte,params);
bAdd.setText("Add");
bAdd.setWidth(250);
mainLayout.addView(bAdd,params);
popUpAddNote.setContentView(mainLayout);
// setContentView(mainLayout);visible

1 个答案:

答案 0 :(得分:0)

在活动清单

中添加以下内容

机器人:windowSoftInputMode = “stateAlwaysVisible”