android - 如何防止软键盘将我的 View 推到 fragment 中?

标签 android keyboard

我的 fragment 中有一个编辑文本。为了防止软键盘将我的 View 向上推,我尝试了

android:windowSoftInputMode="adjustPan"
android:windowSoftInputMode="adjustNothing"

并以编程方式尝试了 fragment 的 onResume 和 oncreateview 方法

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

以上技术不起作用。但是当我将 scrollview 作为 fragment 中的 Root View 并放置 android:isScrollContainer="false" 属性时,上述方法就可以工作......我怎样才能让它在没有滚动的情况下工作查看

最佳答案

在 fragment 的 onCreateView() 中使用它 getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)

关于android - 如何防止软键盘将我的 View 推到 fragment 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36715020/

相关文章:

javascript - 防止在键盘 Tab 键时滚动

javascript - 如何从键盘输入文本并将其存储到变量中?

iOS 交互式键盘揭秘

ios - 快速键盘向上移动两次

android - Ionic native 应用程序正在发送 header Origin :file://which causes problems

android - 默认的android :sharedUserId set if android:sharedUserId was not set是什么

java.lang.UnsupportedOperationException : Can't convert to color: type=0x1 异常

android - 为什么即使创建了新实例,ViewPager 仍保留其当前页面?

android - 如何在android中绘制折线图

keyboard - 程序员针对芬兰语/瑞典语或其他非美国键盘布局的 VIM 设置