在此先感谢您的帮助.
我想在最后或执行以下代码时出现键盘.
// edit text
EditText editText = new EditText(activity);
editText.setBackgroundColor(Color.WHITE);
editText.setGravity(Gravity.TOP);
editText.setText("Type here...");
RelativeLayout relativeLayoutEditText = new RelativeLayout(activity);
RelativeLayout.LayoutParams paramRelativeLayoutEditText = new RelativeLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,43 * display.getHeight() / 80 );
paramRelativeLayoutEditText.addRule(RelativeLayout.ALIGN_PARENT_TOP);
relativeLayoutEditText.addView(editText,paramRelativeLayoutEditText);
// add all created views to rootView
rootView.addView(relativeLayoutEditText,paramEditText);
// open keyboard
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText,InputMethodManager.SHOW_IMPLICIT);
但键盘仅在触摸editText字段后出现(即用我的手指).有没有办法让我可以在不使用物理触摸的情况下自动显示电路板?
顺便说一句,我知道我如何指定宽度和高度并不是正确的做事方式.