【发布时间】:2020-04-29 19:47:43
【问题描述】:
我正在尝试在布局底部使用微调器制作画廊,这会改变画廊的目录。不幸的是,微调器总是向上移动(或者 RecyclerView 约束可能向下移动?)。这是我的代码:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_height="match_parent"
tools:context=".ProjectActivity">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<Spinner
android:id="@+id/spinnerProject"
android:layout_width="141dp"
android:layout_height="100dp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/gallery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/linearLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
知道有什么问题吗?
【问题讨论】:
-
这里的问题是,当您单击微调器时,它会打开并显示微调器上方的数据。发生这种情况是因为,微调器数据显示在回收站视图的上方。
-
问题是我希望 Spinner 与 RecyclerView 完全分离,而是重叠。我想这是我对“wrap_content”的理解不好。
标签: android android-layout android-recyclerview android-spinner android-constraintlayout