【发布时间】:2021-02-16 18:24:58
【问题描述】:
有人能解释一下为什么android:layout_marginBottom 在 Spinner 中不起作用吗?:
<?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">
<Spinner
android:id="@+id/spinner2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginBottom="20dp"/>
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/spinner2" />
</androidx.constraintlayout.widget.ConstraintLayout>
我使用android:layout_marginBottom 或android:layout_margin 都没有关系。但是,如果我使用 android:layout_margin 它会添加顶部、右侧和左侧边距。为什么唯一不起作用的边距是底部?
谢谢。
【问题讨论】:
标签: android spinner android-spinner margins