华为动态标签管理器,点击事件不响应

问题描述

我在项目中实施了华为DTM,

具有依赖项:

implementation 'com.huawei.hms:dtm-api:5.0.0.301'

我将事件添加到如下所示的布局中,但是当我单击该项目时,没有响应。

布局代码:

<androidx.appcompat.widget.LinearLayoutCompat
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:onClick="onReport"
    android:orientation="vertical">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@null"
        android:src="@mipmap/ic_launcher" />

</androidx.appcompat.widget.LinearLayoutCompat>

和我的onReport函数:

public void onReport(View view) {
    Bundle bundle = new Bundle();
    bundle.putDouble("Price",9.99);
    bundle.putDouble("Money",9.99);
    if (instance != null) {
        instance.onEvent("Purchase",bundle);
    }
}

知道我做错了哪一部分吗?

解决方法

您需要在子布局上添加事件报告,但不适用于主布局。

在DTM的下一发行版中,将解决此问题。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...