如何在KeyLongPress上使数字按钮的数字递增和递减?

时间:2018-10-24 15:31:43

标签: android

现在下面的代码让我手动按下+和-按钮以使中间的数字增加或减少;

可以使用onKeyLongPress来连续增加和减少数字。

ImageView img_product_dialog = (ImageView)itemView.findViewById(R.id.img_cart_product);

final ElegantNumberButton txt_count = (ElegantNumberButton)itemView.findViewById(R.id.txt_count);

TextView txt_product_dialog = (TextView)itemView.findViewById(R.id.txt_cart_product_name);

TextView product_description = (TextView)itemView.findViewById(R.id.product_description);

Picasso.with(context)
 .load(foodList.get(position).Link)

 .into(img_product_dialog);

 txt_product_dialog.setText(foodList.get(position).Name);

 product_description.setText(foodList.get(position).Description);

 builder.setView(itemView);

     builder.setNegativeButton("ADD TO CART", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                ShowConfirmDialog(position,txt_count.getNumber());
                dialogInterface.dismiss();
            }
        });
        builder.show();

0 个答案:

没有答案