The effect of clicking a button is doing this: the button.xml file in drawable :
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/button_today_t" android:state_pressed="true" /> <item android:drawable="@drawable/button_today_t" android:state_focused="true" /> <item android:drawable="@drawable/button_today_n" /> </selector> And in the button, respectively, android:background="@drawable/button"
Everything works as it should, but there is one thing, the button becomes visually pressed after ~ 0.2s after touching. In principle, this happens without a decorated button, even with a simple gray. Tell me please, is it possible to do something like this so that the button is visually pressed at the moment of touching? Thank.
UPD
button_today.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN){ button_today.setPressed(true); return true; } return false; } });
onTouchEvent(MotionEvent event)? in theory, this method should work faster - Senior Pomidor