The buttons in my layout are not getting pressed on Enter key. When I click on them using mouse, the code inside onClick() is getting executed. But when I press the Enter key, onClick() is not getting called.
I know that for keys, I must be using onKeyListener instead. However, does onClick() not work for both mouse click and keyboard ‘Enter’? Also, the up and down navigation using arrow keys are working just fine, it is only “Enter” key that is not working!
In my app, I am using nested linear layouts, a theme(button styling), a selector and an anonymous implementation of OnFocusChangeListener. Also, I am using an emulator with specified aspect ratio. Could any of this be attributed to this issue?
Any help would be much appreciated!
–
Kiki
I faced the same problem. Use Image Button instead of Button.
Furthermore, If you still want to use Button then:
Hope this helps.