当我的碎片开始时 - 我想让钥匙走开!如何使键盘在一些片段的开始处不可见?
我试试这个(不工作..)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_behavior, container, false);
//
if (view.requestFocus()) {
InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, InputMethodManager.imm.showSoftInput(view, InputMethodManager.HIDE_IMPLICIT_ONLY);
}
我也尝试定义
<activity android:name="com.your.package.ActivityName"
android:windowSoftInputMode="stateHidden" />
但也不能工作
请...任何帮助:(
谢谢
你是如何加入片段到活动这个代码?我的意思是在ViewPager,FrameLayout通过片段交易,从XML和你可以发布您的片段的xml –