I set the button for focusableand focusableInTouchModeto true (I need it to be customizable). Now, when I click the button, the onCilck event cannot be fired (it gains focus and ignores the onClick event), only when I close the onClick event will it be fired.
I found such solutions:
input.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
v.performClick();
}
}
});
But this solution will also cause some side effect, for example, if we press "next" on the keyboard and move the focus to the button, onClick will light up. This is not what I want.
This problem is really anonymous, is it a mistake? Or is this intentional behavior? Anyway, to solve this problem?
source
share