【问题标题】:Disable soft keyboard in android fragment(Make it never appear in the fragment)?在android片段中禁用软键盘(使其永远不会出现在片段中)?
【发布时间】:2020-06-23 20:27:41
【问题描述】:

我想永久禁止soft-keyboard 出现在android 中的fragment 中。

在我的场景中,有三个片段集成到viewpager 中的activity

当我到达第二个 fragment 时,它只包含一个 spinner。在spinner 下拉列表中,出现keyboard

尝试了堆栈溢出的所有解决方案,但没有任何成功。

帮我永久禁止keyboard出现在第二个fragment

请记住这是平板电脑application

【问题讨论】:

    标签: android keyboard tablet


    【解决方案1】:

    您能分享一下您的尝试吗?

    这对你不起作用吗 - link

    代码

        @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        final InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-06-17
      • 1970-01-01
      • 2017-01-06
      • 1970-01-01
      • 2017-09-22
      • 1970-01-01
      • 2021-07-13
      相关资源
      最近更新 更多