软键盘弹出:(比如点击LinearLayout)
InputMethodManager inputMethodManager=(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
addAddressRemarkInfo.requestFocus();//setFocus方法无效 //addAddressRemarkInfo is EditText
Activity含有EditText初始化隐藏键盘,在布局xml里面添加
<!--屏蔽输入法的-->
<LinearLayout
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true" />
本文介绍了一种在Android应用中控制软键盘显示与隐藏的方法。通过使用InputMethodManager来切换软键盘的状态,并提供了一个初始化隐藏键盘的布局技巧。
4506

被折叠的 条评论
为什么被折叠?



