PanelSwitchHelper
PanelSwitchHelper copied to clipboard
[缺陷] 底部输入框文字过多时会遮挡消息列表
-
Androidx版本:是
-
PanelSwitchHelper版本:v1.4.0
-
手机型号: OnePlus9
-
手机系统版本: Android 12
-
问题描述:底部输入框文字过多时会遮挡消息列表。
-
复现步骤:
- Demo 中将
ChatActivity
测试数据改为 20 条左右。 - 底部输入框中输入多行文本。
- 切换到键盘模式
- Log提供:
正常状态:
2022-08-09 17:17:06.568 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => getCompatPanelHeight :809
2022-08-09 17:17:06.569 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => getContentContainerTop :-809
2022-08-09 17:17:06.569 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout#onLayout => ContentScrollMeasurer(id 2131165436 , defaultScrollHeight 809 , scrollDistance 809 reset false) origin (l 0,t 0,r 0, b 2099)
2022-08-09 17:17:06.569 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout#onLayout => ContentScrollMeasurer(id 2131165436 , defaultScrollHeight 809 , scrollDistance 809 reset false) layout parent(l 0,t -809,r 1080,b 1440) self(l 0,t 0,r 1080, b2099)
2022-08-09 17:17:06.569 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => 界面每一次 layout 的信息回调
layoutInfo = onLayout(changed : true , l : 0 , t : 0 , r : 1080 , b : 2249)
currentPanelState = 显示键盘输入
isPad = false
isFullScreen = false
isPortrait = true
isNavigationShown = true
screenH (static,include SystemUI) = 2400
screenH (static,exclude SystemUI) = 2249
screenH (dynamic,exclude SystemUI) = 2249
localLocation[y] = 103
toolbarH = 0
StatusBarH = 103
NavigationBarH = 48
layout Location = (0,103)
paddingTop = 0
keyboardH = 809
ContentContainerTop = -809
ContentContainerH = 2249
PanelContainerTop = 1440
PanelContainerH = 809
changeBounds = false
contentContainer Layout = (0,-809,1080,1440)
panelContainer Layout = (0,1440,1080,2249)
2022-08-09 17:17:06.570 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#checkoutPanel => checkout success ! lastPanel's id : 0 , panel's id :-1
2022-08-09 17:17:06.570 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onGlobalLayout => 界面每一次变化的信息回调
windowSoftInputMode = 19
currentPanelSwitchLayoutVisible = true
screenHeight = 2400
contentHeight = 2249
isFullScreen = false
isNavigationBarShown = true
deviceStatusBarH = 103
deviceNavigationBarH = 48
systemInset = left(103) top(0) right(0) bottom(48)
inset = left(0) top(103) right(0) bottom(48)
currentSystemInfo = statusBarH : 103, navigationBarH : 48 全面屏手势虚拟栏H : 0
currentSystemH = 151
minLimitCloseKeyboardH = 48
minLimitOpenKeyboardH = 300
lastKeyboardH = 809
currentKeyboardInfo = keyboardH : 0, realKeyboardH : 0, isShown : true
2022-08-09 17:17:06.577 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => getCompatPanelHeight :809
2022-08-09 17:17:06.577 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => getContentContainerTop :0
2022-08-09 17:17:06.578 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout#onLayout => ContentScrollMeasurer(id 2131165436 , defaultScrollHeight 809 , scrollDistance 0 reset true) origin (l 0,t 0,r 0, b 2099)
2022-08-09 17:17:06.578 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout#onLayout => ContentScrollMeasurer(id 2131165436 , defaultScrollHeight 809 , scrollDistance 0 reset true) layout parent(l 0,t 0,r 1080,b 2249) self(l 0,t 0,r 1080, b2099)
2022-08-09 17:17:06.578 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => 界面每一次 layout 的信息回调
layoutInfo = onLayout(changed : false , l : 0 , t : 0 , r : 1080 , b : 2249)
currentPanelState = 收起所有输入源
isPad = false
isFullScreen = false
isPortrait = true
isNavigationShown = true
screenH (static,include SystemUI) = 2400
screenH (static,exclude SystemUI) = 2249
screenH (dynamic,exclude SystemUI) = 2249
localLocation[y] = 103
toolbarH = 0
StatusBarH = 103
NavigationBarH = 48
layout Location = (0,103)
paddingTop = 0
keyboardH = 809
ContentContainerTop = 0
ContentContainerH = 2249
PanelContainerTop = 2249
PanelContainerH = 809
changeBounds = true
reverseResetState = true
contentContainer Layout = (0,0,1080,2249)
panelContainer Layout = (0,2249,1080,3058)
2022-08-09 17:17:06.578 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onGlobalLayout => 界面每一次变化的信息回调
windowSoftInputMode = 19
currentPanelSwitchLayoutVisible = true
screenHeight = 2400
contentHeight = 2249
isFullScreen = false
isNavigationBarShown = true
deviceStatusBarH = 103
deviceNavigationBarH = 48
systemInset = left(103) top(0) right(0) bottom(48)
inset = left(0) top(103) right(0) bottom(48)
currentSystemInfo = statusBarH : 103, navigationBarH : 48 全面屏手势虚拟栏H : 0
currentSystemH = 151
minLimitCloseKeyboardH = 48
minLimitOpenKeyboardH = 300
lastKeyboardH = 0
currentKeyboardInfo = keyboardH : 0, realKeyboardH : 0, isShown : false
切换到键盘状态:
2022-08-09 17:17:36.360 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#checkoutPanel => checkout success ! lastPanel's id : -1 , panel's id :0
2022-08-09 17:17:36.365 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => getCompatPanelHeight :809
2022-08-09 17:17:36.365 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => getContentContainerTop :-809
2022-08-09 17:17:36.366 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout#onLayout => ContentScrollMeasurer(id 2131165436 , defaultScrollHeight 809 , scrollDistance 809 reset false) origin (l 0,t 0,r 0, b 2099)
2022-08-09 17:17:36.366 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout#onLayout => ContentScrollMeasurer(id 2131165436 , defaultScrollHeight 809 , scrollDistance 809 reset false) layout parent(l 0,t -809,r 1080,b 1440) self(l 0,t 0,r 1080, b2099)
2022-08-09 17:17:36.366 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => 界面每一次 layout 的信息回调
layoutInfo = onLayout(changed : false , l : 0 , t : 0 , r : 1080 , b : 2249)
currentPanelState = 显示键盘输入
isPad = false
isFullScreen = false
isPortrait = true
isNavigationShown = true
screenH (static,include SystemUI) = 2400
screenH (static,exclude SystemUI) = 2249
screenH (dynamic,exclude SystemUI) = 2249
localLocation[y] = 103
toolbarH = 0
StatusBarH = 103
NavigationBarH = 48
layout Location = (0,103)
paddingTop = 0
keyboardH = 809
ContentContainerTop = -809
ContentContainerH = 2249
PanelContainerTop = 1440
PanelContainerH = 809
changeBounds = true
reverseResetState = true
contentContainer Layout = (0,-809,1080,1440)
panelContainer Layout = (0,1440,1080,2249)
2022-08-09 17:17:36.367 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onGlobalLayout => 界面每一次变化的信息回调
windowSoftInputMode = 19
currentPanelSwitchLayoutVisible = true
screenHeight = 2400
contentHeight = 2249
isFullScreen = false
isNavigationBarShown = true
deviceStatusBarH = 103
deviceNavigationBarH = 48
systemInset = left(103) top(0) right(0) bottom(48)
inset = left(0) top(103) right(0) bottom(48)
currentSystemInfo = statusBarH : 103, navigationBarH : 48 全面屏手势虚拟栏H : 0
currentSystemH = 151
minLimitCloseKeyboardH = 48
minLimitOpenKeyboardH = 300
lastKeyboardH = 0
currentKeyboardInfo = keyboardH : 0, realKeyboardH : 0, isShown : false
2022-08-09 17:17:36.397 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onGlobalLayout => 界面每一次变化的信息回调
windowSoftInputMode = 19
currentPanelSwitchLayoutVisible = true
screenHeight = 2400
contentHeight = 2249
isFullScreen = false
isNavigationBarShown = true
deviceStatusBarH = 103
deviceNavigationBarH = 48
systemInset = left(103) top(0) right(0) bottom(48)
inset = left(0) top(103) right(0) bottom(48)
currentSystemInfo = statusBarH : 103, navigationBarH : 48 全面屏手势虚拟栏H : 0
currentSystemH = 151
minLimitCloseKeyboardH = 48
minLimitOpenKeyboardH = 300
lastKeyboardH = 0
currentKeyboardInfo = keyboardH : 0, realKeyboardH : 0, isShown : false
2022-08-09 17:17:36.425 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onGlobalLayout => try to set KeyBoardHeight : 809,isShow true
2022-08-09 17:17:36.425 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onGlobalLayout => 界面每一次变化的信息回调
windowSoftInputMode = 19
currentPanelSwitchLayoutVisible = true
screenHeight = 2400
contentHeight = 1440
isFullScreen = false
isNavigationBarShown = true
deviceStatusBarH = 103
deviceNavigationBarH = 48
systemInset = left(103) top(0) right(0) bottom(857)
inset = left(0) top(103) right(0) bottom(48)
currentSystemInfo = statusBarH : 103, navigationBarH : 48 全面屏手势虚拟栏H : 0
currentSystemH = 151
minLimitCloseKeyboardH = 48
minLimitOpenKeyboardH = 300
lastKeyboardH = 0
currentKeyboardInfo = keyboardH : 809, realKeyboardH : 809, isShown : false
2022-08-09 17:17:36.437 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onGlobalLayout => 界面每一次变化的信息回调
windowSoftInputMode = 19
currentPanelSwitchLayoutVisible = true
screenHeight = 2400
contentHeight = 1440
isFullScreen = false
isNavigationBarShown = true
deviceStatusBarH = 103
deviceNavigationBarH = 48
systemInset = left(103) top(0) right(0) bottom(857)
inset = left(0) top(103) right(0) bottom(48)
currentSystemInfo = statusBarH : 103, navigationBarH : 48 全面屏手势虚拟栏H : 0
currentSystemH = 151
minLimitCloseKeyboardH = 48
minLimitOpenKeyboardH = 300
lastKeyboardH = 809
currentKeyboardInfo = keyboardH : 809, realKeyboardH : 809, isShown : true
2022-08-09 17:17:36.606 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => getCompatPanelHeight :809
2022-08-09 17:17:36.607 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => getContentContainerTop :-809
2022-08-09 17:17:36.609 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout#onLayout => ContentScrollMeasurer(id 2131165436 , defaultScrollHeight 809 , scrollDistance 809 reset false) origin (l 0,t 0,r 0, b 2099)
2022-08-09 17:17:36.609 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout#onLayout => ContentScrollMeasurer(id 2131165436 , defaultScrollHeight 809 , scrollDistance 809 reset false) layout parent(l 0,t -809,r 1080,b 1440) self(l 0,t 0,r 1080, b2099)
2022-08-09 17:17:36.609 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onLayout => 界面每一次 layout 的信息回调
layoutInfo = onLayout(changed : true , l : 0 , t : 0 , r : 1080 , b : 1440)
currentPanelState = 显示键盘输入
isPad = false
isFullScreen = false
isPortrait = true
isNavigationShown = true
screenH (static,include SystemUI) = 2400
screenH (static,exclude SystemUI) = 2249
screenH (dynamic,exclude SystemUI) = 1440
localLocation[y] = 103
toolbarH = 0
StatusBarH = 103
NavigationBarH = 48
layout Location = (0,103)
paddingTop = 0
keyboardH = 809
ContentContainerTop = -809
ContentContainerH = 2249
PanelContainerTop = 1440
PanelContainerH = 809
changeBounds = false
contentContainer Layout = (0,-809,1080,1440)
panelContainer Layout = (0,1440,1080,2249)
2022-08-09 17:17:36.609 1011-1011/com.example.demo D/LogTracker: PanelSwitchLayout(64852440)#onGlobalLayout => 界面每一次变化的信息回调
windowSoftInputMode = 19
currentPanelSwitchLayoutVisible = true
screenHeight = 2400
contentHeight = 1440
isFullScreen = false
isNavigationBarShown = true
deviceStatusBarH = 103
deviceNavigationBarH = 48
systemInset = left(103) top(0) right(0) bottom(857)
inset = left(0) top(103) right(0) bottom(48)
currentSystemInfo = statusBarH : 103, navigationBarH : 48 全面屏手势虚拟栏H : 0
currentSystemH = 151
minLimitCloseKeyboardH = 48
minLimitOpenKeyboardH = 300
lastKeyboardH = 809
currentKeyboardInfo = keyboardH : 809, realKeyboardH : 809, isShown : true
请问是否可以重新实现 LinearContentContainer
重写 layoutContainer
来解决此问题
试了下,基于 LinearLayout 实现 的那个场景,依然有相同的问题。输入框行数变化收,RecyclerView的高度也变化了。你可以先尝试监听EditText的高度变化,主动将RecyclerView滚动到最底部。
试了下,基于 LinearLayout 实现 的那个场景,依然有相同的问题。输入框行数变化收,RecyclerView的高度也变化了。你可以先尝试监听EditTextView的高度变化,主动将RecyclerView滚动到最底部。
只监听 EditTextView
的行度变化的话,我猜测再次弹出面板还是会遮挡 RecyclerView
试了下,基于 LinearLayout 实现 的那个场景,依然有相同的问题。输入框行数变化收,RecyclerView的高度也变化了。你可以先尝试监听EditTextView的高度变化,主动将RecyclerView滚动到最底部。
只监听
EditTextView
的行度变化的话,我猜测再次弹出面板还是会遮挡RecyclerView
每次键盘弹起的时候,都可以主动调用RecyclerView滚动到底部
试了下,基于 LinearLayout 实现 的那个场景,依然有相同的问题。输入框行数变化收,RecyclerView的高度也变化了。你可以先尝试监听EditTextView的高度变化,主动将RecyclerView滚动到最底部。
只监听
EditTextView
的行度变化的话,我猜测再次弹出面板还是会遮挡RecyclerView
每次键盘弹起的时候,都可以主动调用RecyclerView滚动到底部
刚刚空下来,写代码验证了一下监听 EditTextView
的行度变化滚动到底部 的方案,发现还是会遮挡。
再试试post或postDelayed的方式呢
发自我的iPhone
------------------ 原始邮件 ------------------ 发件人: Paddington @.> 发送时间: 2022年8月9日 20:13 收件人: DSAppTeam/PanelSwitchHelper @.> 抄送: z少侠会轻功 @.>, Comment @.> 主题: 回复:[DSAppTeam/PanelSwitchHelper] [缺陷] 底部输入框文字过多时会遮挡消息列表 (Issue #172)
试了下,基于 LinearLayout 实现 的那个场景,依然有相同的问题。输入框行数变化收,RecyclerView的高度也变化了。你可以先尝试监听EditTextView的高度变化,主动将RecyclerView滚动到最底部。
只监听 EditTextView 的行度变化的话,我猜测再次弹出面板还是会遮挡 RecyclerView
每次键盘弹起的时候,都可以主动调用RecyclerView滚动到底部
刚刚空下来,写代码验证了一下监听 EditTextView 的行度变化滚动到底部 的方案,发现还是会遮挡。
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
我是基于 ChatActivity
修改的,行数变化则调用 scrollToBottom
方法,scrollToBottom
方法中已经加了 post
了
我这边已经复现了,非常感谢你的反馈