我正在制作一个聊天应用程序,我想添加一个像电报这样的功能来复制链接、电话号码等。我使用这个库在自动链接上添加长点击监听器。我实现了它成功。但是当我这样做时,我想在开始时显示一个 Lottie 动画,但要长按链接。我尝试了很多答案,但我得到了一个例外。我已经为自定义 snakbar 制作了布局。它在下面给出
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="56dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="@dimen/_3sdp"
android:backgroundTint="@color/snakbar_background"
app:cardCornerRadius="@dimen/_4sdp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottieSnakbar"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="@dimen/_5sdp"
android:layout_marginEnd="@dimen/_10sdp"
app:lottie_rawRes="@drawable/copy"
app:lottie_autoPlay="true"
app:lottie_loop="false"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Text copied to clipboard"
android:gravity="center_vertical"
android:theme="?snackbarTextViewStyle"
tools:ignore="HardcodedText" />
</LinearLayout>
</androidx.cardview.widget.CardView>
现在我怎样才能做到这一点?