最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - dispatchKeyEvent method does not receive the dPad(right, left, up and down) events when accessibility is turned on - S

programmeradmin2浏览0评论

We noticed some strange behaviour with dPad event handling in the Android app. We are overriding the dispatchKeyEvent method in the Activity to handle the dPad events in Android TV app. Everything works as expected in normal mode. But when accessibility or talkback is turned on then, dPad events(right, left, up and down) are not received. Because of this navigation functionalities are not working as expected in the accessibility mode.

Please note that dPad Center or OK and Back key events are received. It would be great if someone provide some insights or solution on this particular issue.

Below is the simple code what we are trying. Debug logs are getting printed in regular mode. But in accessibility mode, dispatchKeyEvent method itself not get called.

class VPActivity : FragmentActivity() {

@UnstableApi
@SuppressLint("RestrictedApi")
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
   Log.d("TVApp", "key event " + event)
   return super.dispatchKeyEvent(event)
}

}

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论