Android为TV端助力之查找当前界面焦点所在位置
时间:2019-11-02 15:50:57
收藏:0
阅读:106
View rootview = this.getWindow().getDecorView();
int focusId = rootview.findFocus().getId();
Log.i(TAG,"id = 0x"+Integer.toHexString(focusId));
focusId就是当前焦点的控件ID,我们转换为16进制后,再与R.java文件中的id进行比较,就能知道我们当前焦点是哪个控件了
R.java文件中的ID如下
原文:https://www.cnblogs.com/xiaoxiaing/p/11782233.html
评论(0)