按钮将内容错误地包裹在内部可绘制的内容中

Button wrapping content wrongly with drawable inside

在使用 android 按钮时,我总是遇到同样的问题...当我尝试向按钮添加可绘制对象时,按钮一直错误地为可绘制对象设置框架。

按钮代码:

<Button
        android:id="@+id/cancel_directions_button_v2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:drawableBottom="@drawable/i_close"
        app:layout_constraintStart_toEndOf="@id/info_directions_textview"
        app:layout_constraintBottom_toBottomOf="parent"
        android:backgroundTint="@color/colorPrimary"
        android:layout_marginBottom="26sp"
        android:visibility="gone"
        />

照片:

尝试改用 ImageButton。

<ImageButton
    .
    .
    .
    android:src="@android:drawable/i_close" />