我有一个有趣的问题,我有一个ImageButton(无高程),并且在ImageButton上方放置了一个图像。看起来像是
但是,如果将海拔高度设置为ImageButton(cd图像),则绿色圆圈将转到ImageButton的后面。高程图片;
任何人都知道为什么以及如何解决这个问题?我不知道这个问题。谢谢大家,这是我的 XML代码;
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="@dimen/preset_share_button_width"
android:layout_height="@dimen/preset_share_button_height"
android:layout_marginBottom="50dp"
android:layout_marginStart="32dp"
android:adjustViewBounds="false"
android:background="@drawable/preset_share_icon_background"
android:cropToPadding="false"
android:elevation="6dp"
android:scaleType="centerInside"
android:src="@drawable/add_tone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/imageButton3"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:background="@drawable/tick_background"
android:scaleType="center"
android:src="@drawable/tick_icon"
app:layout_constraintBottom_toTopOf="@+id/imageButton2"
app:layout_constraintEnd_toEndOf="@+id/imageButton2"
app:layout_constraintStart_toEndOf="@+id/imageButton2"
app:layout_constraintTop_toTopOf="@+id/imageButton2" />
<TextView
style="@style/defaultText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:text="Add Tone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/imageButton2"
app:layout_constraintHorizontal_bias="0.555"
app:layout_constraintStart_toStartOf="@+id/imageButton2"
app:layout_constraintTop_toBottomOf="@+id/imageButton2" />
答案 0 :(得分:0)
像这样在ImageView下方更改ImageButton。
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:background="@drawable/tick_background"
android:scaleType="center"
android:src="@drawable/tick_icon"
app:layout_constraintBottom_toTopOf="@+id/imageButton2"
app:layout_constraintEnd_toEndOf="@+id/imageButton2"
app:layout_constraintStart_toEndOf="@+id/imageButton2"
app:layout_constraintTop_toTopOf="@+id/imageButton2" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="@dimen/preset_share_button_width"
android:layout_height="@dimen/preset_share_button_height"
android:layout_marginBottom="50dp"
android:layout_marginStart="32dp"
android:adjustViewBounds="false"
android:background="@drawable/preset_share_icon_background"
android:cropToPadding="false"
android:elevation="6dp"
android:scaleType="centerInside"
android:src="@drawable/add_tone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/imageButton3"
app:layout_constraintStart_toStartOf="parent" />
<TextView
style="@style/defaultText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:text="Add Tone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/imageButton2"
app:layout_constraintHorizontal_bias="0.555"
app:layout_constraintStart_toStartOf="@+id/imageButton2"
app:layout_constraintTop_toBottomOf="@+id/imageButton2" />