【问题标题】:How fragment set the attribute "windowSoftInputMode"片段如何设置属性“windowSoftInputMode”
【发布时间】:2013-05-24 06:45:20
【问题描述】:

我想实现允许editview 高于softinput keyboard 而没有edittext 闪烁的功能(Google plus 的edittextsomekind 闪烁)。

使用activity,我可以设置windowSoftInputMode="adjustPan"来实现这个,但是现在我使用fragment。那么有没有什么方法也可以实现这个效果或者设置fragment的属性。

【问题讨论】:

    标签: android android-fragments android-activity android-manifest


    【解决方案1】:

    片段使用父活动的视图属性。 那么你只需要在对应的activity中添加windowSoftInputMode="adjustPan"即可。

    【讨论】:

      【解决方案2】:

      从片段的 onCreateView() 方法中,您可以这样做:

      getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-03-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多