android - RecyclerView smoothScrollToPosition(lastItem) 滚动到最后一个项目部分可见的底部
问题描述
我正在处理聊天类型屏幕,其中在列表中添加了新的文本消息项,并且 recyclerView 滚动到列表的最后一个位置,但最后一项是部分可见的,并且当键盘打开时不会滚动到底部。我已经添加了
android:layout_width="match_parent"
android:gravity="top"
android:layout_gravity="fill_vertical"
android:windowSoftInputMode="adjustResize"
android:clipToPadding="false"
android:layout_height="match_parent"
app:layout_constrainedHeight="true"
app:layout_scrollFlags="scroll|enterAlways"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_marginBottom="@dimen/margin_5"
到回收站视图。我也尝试过使用 recyclerView.layoutMangaer.smoothScrollToPosition, ScrollBy() 方法,并且还使用了大约 300 毫秒的延迟来滚动。没有任何效果。
将不胜感激一些帮助。谢谢。
解决方案
推荐阅读
- android - 为什么我的 Android 应用程序中的应用程序中心对话框不再显示下载按钮?
- slack - 如何从私人 Slack 频道获取会员?
- angular - Angular - 数据路径“”不应具有其他属性(allowedCommonJsDependencies)
- python - Python 如何管理整数和浮点数的大小?
- python - 如何从fastapi中的另一个api调用一个api?
- r - read_excel 无法读取 xls(MS excel 5.0/95 工作簿),但可以通过另存为 .xlsx 读取
- javascript - 使用对象克隆方法和for循环将对象推入数组,对象仍然是相同的引用,并且在数组中是相同的
- javascript - React + Socket IO:访问第一条消息
- email - 允许对 SQL 数据库进行邮件传递
- image - 用于 JasperReport 中的图像的 Samba 共享