我按照说明进行了所有操作,但是在片段中滚动浏览recyclerview时,工具栏保持静止。 我拥有的Recyclerview位于片段本身中
活动:
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_home"
android:layout_width="match_parent"
android:background="@color/yellow"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways">
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/frag_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom|center_vertical"
android:layout_marginBottom="60dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
片段:
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".note.notes.NotesFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notes"
android:paddingTop="72dp"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:clipToPadding="false"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
非常感谢您的帮助!
答案 0 :(得分:0)
对您的XML进行一些更改:
Vdata(i).cust_ref_id.
希望它对您有用!