我正在尝试使用WindowManager打开一个视图,这个视图将高于我的应用程序的所有活动,但不会高于其他应用程序。
这是我到目前为止所做的:
WindowManager.LayoutParams layOutParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSPARENT);
layOutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
layOutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
LayoutInflater layOutInflater = (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE);
View viewAboveAllActivities = layOutInflater.inflate(R.layout.activity_flash_alert_layout, null);
wm = (WindowManager) context.getSystemService(WINDOW_SERVICE);
wm.addView(viewAboveAllActivities, layOutParams);
我不知道什么是适合我需要的合适布局参数,希望你们能帮忙。