I have set a button to focusable and focusableInTouchMode to true (I need it to be focusable). Now when I click the button, the onCilck event cannot be triggered (it is gaining focus and ignore onClick event), only when I cilck again the onClick event will be triggered.
I found a solutions like this:
input.setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { v.performClick(); } } }); But this solution will cause some side effect as well, for example, if we click 'next' in the keyboard and jump focus to the button, onClick will fire. This is not what I want.
This issue is really anoying, is this a bug? Or it is intentional behaviour? Anyway to solve this?