我在布局内直接使用具有bottomsheetbehaviour 的RecyclerView 时遇到问题。问题是,当底部工作表展开并且内容向下滚动时,当我向上滚动时,它会导致底部工作表开始折叠,而不是 RecyclerView 首先滚动回顶部。
这是演示该问题的视频。正如您所看到的,当我在展开的底部工作表上向下滚动时,问题出现了。它立即开始折叠,而不是“等待”RecyclerView 首先滚动到顶部。
这是我的布局代码
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:id="@+id/scheduleRoot"
android:layout_height="match_parent"
tools:context=".schedule.ScheduleFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scheduleSheet"
app:behavior_peekHeight="300dp"
android:elevation="16dp"
android:clickable="false"
android:focusable="false"
android:background="@drawable/bg_bottom_sheet"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scheduleRecyclerView"
android:clickable="true"
android:focusable="true"
android:layout_marginTop="8dp"/>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏!
我有一个从Firebase实时数据库中提取一些简单数据的应用程序,这里简单易用的就是我想拥有的流程.
如果手机连接到互联网:
如果手机处于离线状态
问题是我没有看到可能的方法来检测firebase缓存中是否有数据可用.因此,当手机处于脱机状态时,我无法看到我是否应该从firebase数据库显示本地存储的数据或缓存.