现在下面的代码让我手动按下+和-按钮以使中间的数字增加或减少;
可以使用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();