这是我的问题
Spinner选择了视图偏见......
这是图片
在未选择的项目中存在长文本而不是偏向选择的视图...
我受苦......请帮帮我......
这是选定项目
我尝试ConstraintLayout -> RelativeLayout
<TextView
android:id="@+id/selected_habit"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="12dp"
android:paddingStart="58dp"
android:paddingEnd="58dp"
app:layout_constraintWidth_default="wrap"
app:layout_constraintHeight_default="wrap"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:textAlignment="center"
android:textColor="@color/colorTextWhite"
android:textSize="22sp"/>
<ImageView
android:id="@+id/habit_spinner_state"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginEnd="40dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/selected_habit"
android:src="@drawable/ic_habit_spinner_closed"/>
<View
android:layout_width="124dp"
android:layout_height="2dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@color/colorWhite"/>
这是未选择的项目
<ImageView
android:id="@+id/selected"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="30dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/habit"
android:src="@drawable/ic_habit_selected"/>
<TextView
android:id="@+id/habit"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="12dp"
android:paddingStart="58dp"
android:paddingEnd="58dp"
app:layout_constrainedWidth="true"
app:layout_constraintWidth_default="wrap"
app:layout_constraintHeight_default="wrap"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:textAlignment="center"
android:textColor="@color/colorTextWhite"
android:textSize="18sp"/>
<ImageView
android:id="@+id/complete"
android:layout_width="14dp"
android:layout_height="17dp"
android:layout_marginEnd="26dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/habit"
android:src="@drawable/habit_complete_icon"/>
<View
android:layout_width="124dp"
android:layout_height="1dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@color/colorWhite"/>
这是Spinner
<com.crew.d.habit.ui.view.DropDownSpinner
android:id="@+id/habit_spinner"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="92dp"
android:spinnerMode="dropdown"
android:overlapAnchor="false"
android:background="@null"
android:popupBackground="@android:color/transparent"
app:layout_constraintWidth_default="wrap"
app:layout_constraintHeight_default="wrap"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />