安卓软键盘的自动弹起/隐藏

Toggle软键盘:

InputMethodManager imm = (InputMethodManager) getActivity()
				.getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);

 隐藏软键盘: 

InputMethodManager im = (InputMethodManager) v.getContext()
						.getSystemService( Context.INPUT_METHOD_SERVICE );  
				if (im.isActive()){  
				    im.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);  
				}

Manifest下设置:

//一个例子,适用于切入页面即触发EditText
<activity 
            android:name="com.uustudio.unote.activity.NoteEditActivity"
            android:label="@string/app_name" 
            android:configChanges="orientation|keyboardHidden|locale" 
            android:screenOrientation="portrait" 
            android:windowSoftInputMode="stateVisible|adjustPan" >
原文地址:https://www.cnblogs.com/misybing/p/4833689.html