How to programmatically include the mouse cursor in android tv

こ雲淡風輕ζ 提交于 2021-01-29 13:33:46

问题


I use Webview, which loads random sites. For good navigation I need to turn on the mouse cursor, which will be controlled by D-pad, but I did not find information on how to do it, maybe someone can have developed such navigation, I will be grateful for any help.


回答1:


Use pointer capture

A view in your app can request pointer capture only when the view hierarchy that contains it has focus. For this reason, you should request pointer capture when there's a specific user action on the view, such as during an onClick() event, or in the onWindowFocusChanged() event handler of your activity.

To request pointer capture, call the requestPointerCapture() method on the view. The following code example shows how to request pointer capture when the user clicks a view:



来源:https://stackoverflow.com/questions/64350673/how-to-programmatically-include-the-mouse-cursor-in-android-tv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!