如何使recyclerview的卡片按钮点击事件与卡片点击事件本身不同

时间:2020-05-01 12:57:00

标签: android android-recyclerview

我有一个回收站视图,每个卡都可以单击。

现在,卡上有一个按钮,当用户单击它时,它会触发2个事件。 1.父母(卡)事件。 2.按钮事件。

如何在卡中单击按钮后禁用父级事件?

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        Order order = orders.get(position);
        holder.txtOrderDatetime.setText(order.getDate());
        holder.txtOrderStatus.setText(String.valueOf(order.getStatus()).toUpperCase());
        holder.btn_pay.setOnClickListener(v ->
                Utility.displayToast("Clicked")
        );
    }

0 个答案:

没有答案