Nin*_*XX2 2 android android-layout android-fragments kotlin android-mvvm
我正在尝试解决我的回收器视图与底部应用栏重叠的问题。这是我的布局代码。
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/notes_container_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:padding="8dp"
android:text="@string/myTasksHeader"
android:textColor="@color/appBarTextColor"
android:textSize="40dp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:padding="16dp"
android:scrollbars="none"
tools:listitem="@layout/note_list_item" />
</ScrollView>
</LinearLayout>
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottomAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:backgroundTint="@color/colorPrimary"
app:hideOnScroll="false"
app:menu="@menu/appbar_menu"
app:navigationIcon="@drawable/ic_menu" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/add_note_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/medium_margin"
android:backgroundTint="@color/colorPrimary"
app:layout_anchor="@id/bottomAppBar"
app:srcCompat="@drawable/ic_add_black_24dp"
tools:ignore="VectorDrawableCompat" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
当我填写列表时,我无法到达回收器视图中的最后一个项目。我尝试添加保证金,但没有成功。

使用边距的问题是 RecyclerView 不会通过 FAB 显示。比使用边距更好的解决方案是使用填充在 RecyclerView 的底部添加额外的空间。
android:clipToPadding="false"
android:paddingBottom="?actionBarSize"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1255 次 |
| 最近记录: |