google tv上webview页面js实现焦点跳转
2016-07-09 19:09
741 查看
我们在webview里面使用javascript处理按键遇到了焦点问题,于是google,发现了stackoverflow里面的答案,http://stackoverflow.com/questions/19716840/handle-arrow-keys-from-d-pad-on-webview-google-tv-app。
于是从https://code.google.com/archive/p/googletv-android-samples/source/default/source这里下载了代码。
我把http-client的js代码拷贝到了本地的assets目录,发现焦点仍然不起作用。于是跟到了js代码,发现了如下代码
原来这里有限制,于是我修改了代码,发现可用。
具体工程代码可以从这里下载,在Android Studio测试有效。
于是从https://code.google.com/archive/p/googletv-android-samples/source/default/source这里下载了代码。
我把http-client的js代码拷贝到了本地的assets目录,发现焦点仍然不起作用。于是跟到了js代码,发现了如下代码
IndexPage.prototype.setUpKeyHandling = function () { if(this.isEmbedded()) { // We want the native app to access this window.androidKeyHandler = new AndroidKeyHandler(this.getFocusController()); } };
原来这里有限制,于是我修改了代码,发现可用。
IndexPage.prototype.setUpKeyHandling = function () { // if(this.isEmbedded()) { // We want the native app to access this window.androidKeyHandler = new AndroidKeyHandler(this.getFocusController()); // } };
具体工程代码可以从这里下载,在Android Studio测试有效。
相关文章推荐
- 我的Android进阶之旅------>Android Listview跳到指定条目位置的两种实现方法
- 安卓知识点
- iOS学习(二十二)Objective-C 动态识别的应用
- 浅显易懂的Activity生命周期
- cannot resolve symbol R解决方法。
- IOS常用代码总结 - 第三方库部分
- Android设置背景色
- adb连接Android 4.2.2版本手机时出现offline或unauthorized问题的解决方法
- Android四大基本组件介绍
- Android内存优化之——static使用篇
- iOS学习(二十一)Objective-C SEL和IMP类型
- android studio gradle 配置模板
- UVA - 299 Train Swapping
- Bitmap高效加载图片
- Android APK反编译就这么简单 详解(附图)
- Android APK反编译就这么简单 详解(附图)
- Android APK反编译就这么简单 详解(附图)
- Android APK反编译就这么简单 详解(附图)
- Android APK反编译就这么简单 详解(附图)
- Android之自定义开关控件