首先传两张需要用的图片
add
del
自定义
AddDecreaseView类
/** * Created by 撩个小媳妇 on 2018/5/10. */ public class AddDecreaseView extends LinearLayout{ public AddDecreaseView(Context context) { this(context, null); } public AddDecreaseView(Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); } public AddDecreaseView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initView(context); } private EditText etNum; //定义接口 public interface OnAddDecreseClickListener { void onClickDecrease(View v); void onClickAdd(View v); } // 2. 声明一个接口对象 private OnAddDecreseClickListener listener; // 3. 给外部提供一个设置接口对象的方法 public void setOnAddDecreaseClickListener(OnAddDecreseClickListener listener) { this.lis