Android EditText在ConstraintLayout中被软键盘切成两半
我正在尝试创建一个聊天版面,因此我有一个带有EditText(使用圆角背景)和ImageButton的recyclerview来发送消息,但是当软键盘出现时,它会覆盖EditText和ImageButton的一小部分 我的Android EditText在ConstraintLayout中被软键盘切成两半,android,android-softkeyboard,bottomnavigationview,Android,Android Softkeyboard,Bottomnavigationview,我正在尝试创建一个聊天版面,因此我有一个带有EditText(使用圆角背景)和ImageButton的recyclerview来发送消息,但是当软键盘出现时,它会覆盖EditText和ImageButton的一小部分 我的AndroiManifest 我试过: 使用android:WindowsOfInputMode=“adjustResize它占用了一切,包括我的底部导航视图(我不想要) 将app:paddingBottomSystemWindowInsets=“@{true}”放在我的Co
AndroiManifest
我试过:
- 使用android:WindowsOfInputMode=“adjustResize它占用了一切,包括我的
(我不想要)底部导航视图
- 将
放在我的ConstraintLayout上app:paddingBottomSystemWindowInsets=“@{true}”
在您的recyclerview中添加底部填充“16”。我找到了一个解决方法,可以这样做:
我回到了我的AndroidManifest中的adjustPan
在我的片段中,我添加了:
override-fun-onCreate(savedInstanceState:Bundle?){
super.onCreate(savedInstanceState)
活动?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT\u INPUT\u ADJUST\u RESIZE);
}
覆盖已创建的视图(视图:视图,保存状态:捆绑?){
super.onViewCreated(视图,savedInstanceState)
//我创建的用于隐藏/显示底部导航的扩展方法
require().showBottomNavBar(false)
}
重写onDestroyView(){
super.onDestroyView()
require().showBottomNavBar(真)
活动?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT\u INPUT\u ADJUST\u PAN)
}