gpt4 book ai didi

android - 如何使用adjustResize设置隐藏键盘下方的BottomNavigationView

转载 作者:IT老高 更新时间:2023-10-28 21:55:31 32 4
gpt4 key购买 nike

根据material design spec ,当键盘出现时,BottomNavigationView 应该隐藏在它下面。但是,如果我在 Activity 的 list 中设置 android:windowSoftInputMode="adjustResize" 那么 BottomNavigationView 会在键盘上方移动。

我需要设置 adjustResize 以在键盘打开时启用滚动到屏幕底部。但是,我不希望 BottomNavigationView 可见。这个可以吗?

目前的样子:

enter image description here

布局 XML(实际上会有一个 FrameLayout,其中 EditTextEditText 将在其中):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Input"
android:layout_gravity="center"
android:layout_centerVertical="true"/>

<android.support.design.widget.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:itemBackground="@color/colorPrimary"
app:menu="@menu/menu_bottom_navigation"
app:itemIconTint="@android:color/white"
app:itemTextColor="@android:color/white"/>

</RelativeLayout>

最佳答案

将此添加到 list 中的 Activity

android:windowSoftInputMode="adjustPan"

很喜欢

<activity android:name=".feature.home.HomeActivity" 
android:windowSoftInputMode="adjustPan"/>

关于android - 如何使用adjustResize设置隐藏键盘下方的BottomNavigationView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42051956/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com