如何防止底部导航栏在显示的键盘上被向上推 [英] How to keep a bottom nav bar from being pushed up on keyboard shown

查看:161
本文介绍了如何防止底部导航栏在显示的键盘上被向上推的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当软键键盘弹出时,如何创建不会随视图向上移动的粘性页脚?

How can i create a sticky footer that wont be moved up with the view when the softkey keyboard popups up?

下面是我当前设置以及我想要实现的图像示例. 我有一个滚动视图,其中包含我的页面内容和一个线性布局,该线性布局与充当导航栏的父底部对齐.

Below is an image example of my current setup and what i want to achieve. I have a scrollview that contains my page content and a linearlayout that is aligned to the parent bottom that acts as a nav bar.

问题是,当键盘弹出时,它会推高我的整个视图,包括底部的导航部分. 我不想禁用视图的自动上推(通过设置android:windowSoftInputMode="adjustPan"),而是排除单个元素被上推,这是我的底部导航栏.

Problem is that when the keyboard popups, it pushes my entire view up, including the bottom nav section. I do not want to disable the automatic pushing up of the view (by setting android:windowSoftInputMode="adjustPan") but rather exclude a single element from being pushed up, my bottom nav bar.

我已经测试了windowSoftInputMode修复程序,但是它将我的页面内容隐藏在键盘后面.有没有办法让它继续向上滚动scrollview,而不是底部导航栏?我的另一个选择是在键盘上设置visibility:gone,然后在键盘下显示visibility:gone,但这似乎过于复杂,而且根据我的阅读并不总是可靠的.

I have tested the windowSoftInputMode fix but it hides my page content behind the keyboard. Is there a way to have it continue pushing up the scrollview but not the bottom nav? My other option was to set visibility:gone on keyboard up and then reshow it on keyboard down, but that seems overly complicated and not always reliable from what i read.

如果任何人有任何示例或建议,我都很高兴.谢谢.

If anyone has any examples or suggestions, i'm all ears. Thanks.

推荐答案

可以将其添加为滚动条的XML属性

Either add this as scrollbar's XML attribute

android:isScrollContainer ="false"

android:isScrollContainer="false"

或将其添加到清单的活动标签中

or add this in Activity's tag in Manifest

android:windowSoftInputMode ="adjustPan"

android:windowSoftInputMode="adjustPan"

这篇关于如何防止底部导航栏在显示的键盘上被向上推的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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