编辑:经过更多测试,我认为下面提到的问题是单击而不是禁用时发生的。研究海拔高度,看看点击是否可能改变这一点。
我正在使用约束布局,并且有两个包含图像的按钮。 用户单击时,其中之一将被临时或永久禁用。 问题?第二个按钮(应留在后面)最终覆盖另一个新禁用的按钮。 我尝试搜索与此有关的任何内容,但找不到任何可帮助我解决此问题的内容。我还尝试过将ImageView用作应该留在下方的按钮,但也无法正常工作。
// the button that should stay underneath
<Button
android:id="@+id/bg_pup_img"
android:contentDescription="@string/pup2_desc"
android:layout_width="0dp"
android:layout_height="400dp"
android:layout_marginTop="120dp"
android:scaleType="fitEnd"
android:background="@drawable/pup2"
android:enabled="false"
android:clickable="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/end_game"
app:layout_constraintVertical_bias="1.5" />
// the button I want to stay at the top
<Button
android:id="@+id/card19"
android:layout_width="60dp"
android:layout_height="80dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="40dp"
android:layout_marginRight="40dp"
android:background="@drawable/blank_card"
android:tag="19"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/card15" />