【发布时间】:2020-11-04 08:45:21
【问题描述】:
我有一个包含许多项目的回收站视图。
但第一个项目就像一个介绍屏幕,它有一个按钮,用户可以点击该按钮查看更多信息,或者用户可以滚动查看更多数据。
如下所示。
我希望这个按钮位于屏幕底部,在小型设备中,除非用户滚动视图,否则它是不可见的。所以基本上布局占用了更多的高度,所以用户必须滚动才能查看完整的布局。
我正在使用约束布局,并将其连接到视图的底部。
视图中只有2个项目,1个是imageView,它没有任何图像,我只是给它添加了背景色,另一个是TextView。
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/Black_Color"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center"
android:layout_marginBottom="50dp"
android:textSize="17dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</
【问题讨论】:
-
需要更多详细信息。
标签: android android-layout android-recyclerview android-constraintlayout