I have looked at the answers here - Android Preventing Double Click On A Button
and implemented qezt\'s solution like and I\'ve tried setEnabled(false)
like so
Suru's answer worked well for me, thanks!
I'd like to add the following answer for anybody who's using https://github.com/balysv/material-ripple/blob/master/library/src/main/java/com/balysv/materialripple/MaterialRippleLayout.java and is facing this problem -
app:mrl_rippleDelayClick
is true by default.
This means, onClick will be executed only after it's finished showing the ripple. Hence setEnabled(false)
inside onClick will be executed after a delay because the ripple isn't done executing and in that period you may double click the view.
Set app:mrl_rippleDelayClick="false"
to fix this. This means the call to onClick will happen as soon as the view is clicked, instead of waiting for the ripple to finish showing.