@ Override @ SuppressLint ( "NewApi" ) public boolean onTouch ( View v , MotionEvent event ) { if ( touchable ) { if ( event . getAction ( ) == MotionEvent . ACTION_DOWN ) { view . setBackgroundColor ( colorPressed ) ; return true ; } if ( event . getAction ( ) == MotionEvent . ACTION_CANCEL ) { if ( isSelected ) view . setBackgroundColor ( colorSelected ) ; else view . setBackgroundColor ( colorUnpressed ) ; return true ; } if ( event . getAction ( ) == MotionEvent . ACTION_UP ) { view . setBackgroundColor ( colorSelected ) ; afterClick ( ) ; return true ; } } return false ; }
touch event without ripple support