TYPE_PHONE overlay view doesn't allow child GridView to capture onItemClick event

爷,独闯天下 提交于 2019-12-08 07:06:34

问题


My applications draws an overlay which has a GridView as it's child. All the clicks are being captured by the overlay veiw's onTouch event and nothing is passed to the GridView's onItemClick event. The code which creates it is:

LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
TaskBarView = inflater.inflate(R.layout.view_overlay, null);
TaskBarViewParams = new WindowManager.LayoutParams(TaskBarInactiveWidth, TaskBarHeight,
            LayoutParams.TYPE_PHONE,
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
            WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
            PixelFormat.TRANSLUCENT);
TaskBarViewParams.gravity = Gravity.LEFT | Gravity.TOP;
windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
windowManager.addView(TaskBarView, TaskBarViewParams);

Note: This problem only comes into picture on API levels 16 and up. The GridView captures it's onItemClick and the overlay captures it's onTouch properly as it should below API level 16.

Am I missing a flag or something?

来源:https://stackoverflow.com/questions/18488076/type-phone-overlay-view-doesnt-allow-child-gridview-to-capture-onitemclick-even

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!