Solution to invalid return key of Android onkeydown listening

Solution to invalid return key of Android onkeydown listening

When our activity inherits tabactivity, overriding onkeydown in this class cannot listen for the return key,

The specific solutions are as follows:

Override dispatchkeyevent

If you only listen for the back key of an activity, you only need to override this method

We can take a look at the default implementation of the super. Onbackpressed () method:

If you want to mask the back key, just annotate the super. Onbackpressed () method

However, this method is not applicable to tabacity

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>