简体   繁体   English

当键盘弹出 ScrollView 中的 EditText 时,BottomNavigation 不会隐藏

[英]BottomNavigation not hiding when keyboard pops for EditText in ScrollView

I'm new to android development.我是安卓开发的新手。 I'm using latest android studio and trying to develop an android app.我正在使用最新的 android studio 并尝试开发一个 android 应用程序。 I'm using Bottom Navigation to swap among different fragments.我正在使用底部导航在不同的片段之间进行交换。 I've used ScrollView on the fragment_container in the activity_main.xml file.我在activity_main.xml 文件中的fragment_container 上使用了ScrollView。 Each fragment contains an EditText and whenever I tap the EditText to enter something, the keyboard pops up and so does the BottomNavigation on top of keyboard.每个片段都包含一个 EditText,每当我点击 EditText 输入内容时,键盘都会弹出,键盘顶部的 BottomNavigation 也会弹出。 I can't get the BottomNavigation to hide.我无法隐藏底部导航。 Whenever i enable the ScrollView, the BottomNavigation also comes up with the keyboard.每当我启用 ScrollView 时,BottomNavigation 也会随键盘一起出现。 If i remove the SCrollView than it doesn't.如果我删除 SCrollView 则不会。 Is there any way to hide it with XML file?有没有办法用 XML 文件隐藏它? Or it can only be done via code?还是只能通过代码来完成?

1: https://i.stack.imgur.com/HwN9v.png 1: https : //i.stack.imgur.com/HwN9v.png

2: https://i.stack.imgur.com/zz0DX.png 2: https : //i.stack.imgur.com/zz0DX.png

Add this code in your manifest like this way.像这样在您的清单中添加此代码。

<activity android:name=".MainActivity"
    android:windowSoftInputMode="adjustPan">

This work for me, Happy Coding这对我有用,快乐编码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM