【发布时间】:2021-07-22 13:51:21
【问题描述】:
我正在使用 Android Studio 开发一个 Android 应用,但在使用回收站视图顶部的浮动按钮时遇到问题。 我想要实现的是在我的回收站视图顶部有一个浮动按钮,当我滚动到回收站视图的底部时,该按钮不应覆盖我列表中的最后一项。
如果我在我的回收站视图中添加填充或边距,这就是我得到的:
结果是没有填充也没有边距:
我的目标是在滚动到最后一项时得到这个:
当我不在最后一项时:
这是我目前拥有的代码:
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".frontend.MainActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/activityList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animationCache="true"
android:background="@color/white"
android:layout_marginTop="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/addRoutine"
style="@style/Widget.AppCompat.Button"
android:layout_width="60dp"
android:layout_height="60dp"
android:background="@drawable/round_button"
app:iconPadding="0dp"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
如果有人能说出这是如何实现的,我将不胜感激。
谢谢!
【问题讨论】:
标签: android xml android-layout android-recyclerview