I have one simple solution using that you can set default press effect to button.
// Create button and add event
//touch listner
// Create button and add event
Button addImageView = (Button) bottomView.findViewById(R.id.addImage);
addImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// click event
}
});
//Using this code set touch listener
addImageView.setOnTouchListener(touchEffect);
//touch listner
OnTouchListener touchEffect = new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: {
v.getBackground().setColorFilter(0xe0f47521,PorterDuff.Mode.SRC_ATOP);
v.invalidate();
break;
}
case MotionEvent.ACTION_UP: {
v.getBackground().clearColorFilter();
v.invalidate();
break;
}
}
return false;
}
};