如何避免软键盘推高我的布局? [英] How to avoid soft keyboard pushing up my layout?

查看:26
本文介绍了如何避免软键盘推高我的布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在每个活动的底部都有一组导航按钮.在某些活动中,我需要在它的顶部添加一个搜索文本视图.但是,每当用户在 textview 中键入内容时,软键盘总是向上推我的导航按钮,即使它实际上并没有阻止 textview.它让我的 UI 看起来很有趣.如何强制我的导航按钮保持静止,而不会被软键盘推动?我尝试设置 Activity 的 windowSoftInputMode,但没有任何配置帮助.

I have a set of navigation buttons sitting at the bottom of each Activity. In some activities, I need a search textview at the top of it. However, whenever the user types something in the textview, the soft keyboard always pushes up my navigation buttons, even though it doesn't actually block the textview. It makes my UI looks funny. How can I force my navigation buttons to stay static where they are without ever being pushed by the soft keyboard? I have tried to set the Activity's windowSoftInputMode, but none of the configurations help.

有什么建议吗?谢谢

推荐答案

我确实遇到了同样的问题,一开始我补充说:

I did have the same problem and at first I added:

<activity
    android:name="com.companyname.applicationname"
    android:windowSoftInputMode="adjustPan">

到我的清单文件.但这并不能解决问题.然后正如 Artem Russakovskii 提到的,我补充说:

to my manifest file. But this alone did not solve the issue. Then as mentioned by Artem Russakovskii, I added:

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:isScrollContainer="false">
</ScrollView>

在滚动视图中.

这对我有用.

这篇关于如何避免软键盘推高我的布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆