【发布时间】:2019-05-24 11:24:24
【问题描述】:
我有一个 BottomsheetDialogFragment,它有一个普通的 Fragment,它有一个 recyclerview。问题是我无法滚动 recyclerview。
我曾想过使用 NestedScrollView,但我在片段中有搜索功能。当小键盘弹出时,它工作正常,但一旦小键盘隐藏,底页的过渡就不好了。所以,我无法使用它。
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinatorlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/whitebackground"
android:focusable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/whitebackground"
>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
在运行时,我正在膨胀包含 recyclerview 的布局。
【问题讨论】:
-
您是否尝试过让滚动视图的“fillviewport”属性为真并导致回收器视图启用嵌套滚动?在设置 recyclerview 适配器 ViewCompat.setNestedScrollingEnabled(recyclerView, false); 后立即使用此行
-
添加recyclerview后是否尝试过验证相关布局?
-
你能定义什么是
not okay吗?视频会很有帮助。 -
我已经完成了滚动部分,但现在出现了新错误。我将recyclerview的高度设置为500dp左右。底部有一个空间,recyclerview 向上移动到屏幕顶部。
-
@Sniper 嘿,请分享您的解决方案或提供对答案的反馈。否则,任何访问此问题的人都会空手而归。社区试图帮助您,请提供帮助。
标签: android android-fragments scroll bottom-sheet android-nestedscrollview