Android Webview cannot focus on its elements

I have an Android app for Android, so all my controls use focus (remote). I have a webview that downloads a url and displays content. This page now has a section in the center, and there are two buttons in this section. Now the main attention is paid to the section itself, and it does not go inside and does not focus on buttons. If I press the up and down buttons on the remote control, the page just scrolls up and down, but the focus does not move inside the buttons. Any idea how I can solve this? Thanks.

+6
source share
2 answers

Hi you can try something like this

mWebview.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_UP: if (view.hasFocus() == false) { view.requestFocus(); } break; } return false; } }); 
0
source

I think you need a cover in your web browser that contains navigation over the web view.

After that, disable all user actions in this webview. (tap, focus, etc.)

Customization buttons and redirecting user actions to web browsing.

For instance,

Press the UP → redirect button to scroll through the web view.

0
source

All Articles