Android ROM开发解决bug时如何知道当前是哪个组件在处理TOUCH事件
在frameworks\base\core\java\android\view\View.java 添加如下log:
public boolean onTouchEvent(MotionEvent event) {
android.util.Log.v("VIEW_LOG_TAG","onTouchEvent this:"+this);
触摸界面,获取log:
11-27 16:10:08.964 1544-1544/? V/mfttest: this:com.android.camera.ui.CameraControlsTop{4181e0d0 V.E..... ........ 0,0-240,320 #7f0e001c app:id/control_panel_top}
11-27 16:10:08.974 1544-1544/? V/mfttest: this:android.view.View{418ac260 V.ED..C. ........ 0,0-240,320 #7f0e0010 app:id/blocker}
11-27 16:10:09.014 1544-1544/? V/mfttest: this:android.view.View{418ac260 V.ED..C. ...p.... 0,0-240,320 #7f0e0010 app:id/blocker}
11-27 16:10:09.044 1544-1544/? V/mfttest: this:android.view.View{418ac260 V.ED..C. ...p.... 0,0-240,320 #7f0e0010 app:id/blocker}
11-27 16:10:09.084 1544-1544/? V/mfttest: this:android.view.View{418ac260 V.ED..C. ...p.... 0,0-240,320 #7f0e0010 app:id/blocker}
11-27 16:10:09.094 1544-1544/? V/mfttest: this:android.view.View{418ac260 V.ED..C. ...p.... 0,0-240,320 #7f0e0010 app:id/blocker}
11-27 16:10:12.854 1544-1544/? V/mfttest: this:android.widget.FrameLayout{4184c6e0 V.E..... ........ 0,0-240,320 #7f0e0022 app:id/camera_above_filmstrip_layout}
11-27 16:10:12.894 1544-1544/? V/mfttest: this:com.android.camera.ui.CameraControlsTop{4181e0d0 V.E..... ........ 0,0-240,320 #7f0e001c app:id/control_panel_top}
11-27 16:10:12.914 1544-1544/? V/mfttest: this:android.view.View{418ac260 V.ED..C. ........ 0,0-240,320 #7f0e0010 app:id/blocker}
11-27 16:10:12.934 1544-1544/? V/mfttest: this:android.view.View{418ac260 V.ED..C. ...p.... 0,0-240,320 #7f0e0010 app:id/blocker}
11-27 16:10:12.954 1544-1544/? V/mfttest: this:android.view.View{418ac260 V.ED..C. ...p.... 0,0-240,320 #7f0e0010 app:id/blocker}
根据ID找到对应组件。
本文地址:https://blog.csdn.net/mickeymousemei123/article/details/110237217