0

I am building an app for Google TV which has Tabs on the left side of the app (LeftNavBar library). I have a Fragment that is displayed on the right side of my app. This Fragment is mapped to one of the Tabs and contains a WebView.

Initially the focus is on the Tab and pressing the right D-Pad button moves the focus on the WebView (Works great).

The issue that I am having is that when pressing the left D-Pad button to move the focus back to the Tab, the WebView refuses to lose Focus.

  • Note that the focus doesn't change when pressing only the Left D-Pad button. The Right D-Pad DOES changes the Focus if there's something on the right side of the WebView.
pedab
  • 1
  • 2

1 Answers1

0

I had this issue, and got around it by capturing the press of the Left D-Pad button within the webview itself, and then requesting focus of the parent view. E.g.

    mWebView.setOnKeyListener(new OnKeyListener() {         
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if(keyCode == KeyEvent.KEYCODE_DPAD_LEFT && event.getAction() == KeyEvent.ACTION_DOWN) {
                //requestFocus() on parent view
                return true;
            }
            return false;
        }
    });   
lamplightdev
  • 2,041
  • 1
  • 20
  • 24