的WebView不希望失去焦点时pressing D - 垫按钮 - 谷歌电视 [英] WebView does not want to lose Focus when Pressing D-Pad button - for Google TV
问题描述
我建立谷歌电视里面有选项卡上的应用程序(LeftNavBar库)左侧的应用程序。我有一个显示在我的应用程序的右侧有一个片段。这个片段被映射到标签中的一个,并包含一个web视图。
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.
最初的重点是Tab和pressing右方向键按钮移动专注于web视图(伟大工程)。
Initially the focus is on the Tab and pressing the right D-Pad button moves the focus on the WebView (Works great).
这是我遇到的问题是,当pressing左方向键键将焦点移回到标签,web视图拒绝失去焦点。
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.
- 请注意,焦点不会更改在pressing只有左方向键按钮。正确的D-垫DOES更改焦点,如果有对的WebView右边的东西。
推荐答案
我有这个问题,通过捕捉左方向键按钮的preSS web视图本身,然后要求的重点得到了周围父视图。例如。
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;
}
});
这篇关于的WebView不希望失去焦点时pressing D - 垫按钮 - 谷歌电视的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!