Android查找当前获取焦点的View

2021-06-08 21:59:39 浏览数 (1)

代码语言:javascript复制
new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    try {
                        Thread.sleep(3000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    View rootview = getWindow().getDecorView();
                    View focusView = rootview.findFocus();
                    Log.i("Zachary", "===当前获取焦点的View===" focusView.toString());
                }
            }
        }).start();

0 人点赞