android/kotlin : Material Button 显示一个灰色框,然后框消失

问题描述

short clip of the issue

在上面的剪辑中,您将能够更好地看到问题。 在 Fragment 之间切换用户可以在素材按钮上的图标上看到一个灰色的框形元素短时间。

我尝试同时使用模拟器和真实设备。因为我在我的项目中使用了 Lottie,所以它开始了定制的 svg 导入图标.. 我想我不太确定是什么原因造成的。

<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="14dp"
android:clickable="true"
app:cardCornerRadius="4dp"
app:cardElevation="8dp">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <ImageView
        android:id="@+id/imageViewWorkout"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:src="@drawable/ic_training_arm" />
    <TextView
        android:id="@+id/workoutDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="14dp"
        android:layout_toEndOf="@id/imageViewWorkout"
        android:text="workout date"
        android:textSize="16sp"
        android:visibility="gone" />
    <TextView
        android:id="@+id/workoutName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="14dp"
        android:layout_toEndOf="@id/imageViewWorkout"
        android:layout_toRightOf="@id/workoutCalories"
        android:text="workout name"
        android:textSize="16sp" />
    <TextView
        android:id="@+id/workoutCalories"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/workoutName"
        android:layout_marginStart="14dp"
        android:layout_toEndOf="@id/imageViewWorkout"
        android:text="workout calories"
        android:visibility="gone" />
    <com.google.android.material.button.MaterialButton
        android:id="@+id/deleteButton"
        android:layout_width="35dp"
        android:layout_height="35dp"
        android:layout_below="@id/workoutName"
        android:layout_alignParentRight="true"
        android:background="@drawable/delete_foreground" />
    <com.google.android.material.button.MaterialButton
        android:id="@+id/editButton"
        android:layout_width="35dp"
        android:layout_height="35dp"
        android:layout_alignParentRight="true"
        android:layout_toStartOf="@id/deleteButton"
        android:background="@drawable/edit_foreground" />
</RelativeLayout>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)