內我都顯示警告對話框時所顯示的代碼,我認爲應該努力迫使鍵盤。炫耀武力軟鍵盤從AlertDialog
public void showTypeBox(){
edit = new EditText(this);
edit.setPadding(10, 0, 0, 10);
AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle("Type word to search for:")
.setPositiveButton("Search", Main.this)
.setNegativeButton("Cancel", null)
.setView(edit)
.setIcon(R.drawable.menu_icon)
.create();
dialog.show();
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(edit, InputMethodManager.SHOW_IMPLICIT);
}
我不明白我在這裏做錯了什麼。
想要在文本框的焦點上顯示鍵盤? – 2011-06-10 15:50:20