将TextView与ConstraintLayout中的微调器正确对齐?

Okw*_*gls 2 android android-spinner android-constraintlayout

我有一个表示表单的活动布局.表单包含一些表单字段,包括Spinner.

布局类型为ConstraintLayout.

在此输入图像描述

因为Spinner控件没有基线,所以我无法正确地垂直对齐我的"Kind"标签.我在顶部使用24 dp作为临时值.解决方案,但因为Spinner的高度增加,我不喜欢这个解决方案.

是否有更好的解决方案让Kind标签正确对齐?

Ram*_*mli 8

<TextView android:id="@+id/video"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Lorem Ipsum"
          app:layout_constraintBottom_toBottomOf="@+id/spinner"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintRight_toRightOf="parent"
          app:layout_constraintTop_toTopOf="@+id/spinner" />
Run Code Online (Sandbox Code Playgroud)

将视图的底部和顶部锚定到另一个视图时,它将相对居中.这在垂直和水平方向上都有效.
希望这可以帮助.