Home view added to windowmanager.addview() from background service, get displaced above the notification panel
Reply: 0

view added to windowmanager.addview() from background service, get displaced above the notification panel

user1563
1#
user1563 Published in June 23, 2018, 9:21 pm

I have added a view to windowmanager from a background service. Because I have to show the view across the activities. Below code is working well except when user pull downs Notification Bar. The added view appears over the Notifications instead of appearing behind the notifications. Does anybody know how to move this view behind Notification bars? For more clarity please look at this image : https://i.stack.imgur.com/QMtqx.png

 windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    final WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
    layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
    layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT;

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
        layoutParams.type = WindowManager.LayoutParams.TYPE_TOAST;
    } else{
        layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
    }

    layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;

    layoutParams.format = PixelFormat.TRANSLUCENT;
    layoutParams.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;

    layoutParams.y = 40;
    layoutParams.x = 0;

    LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    View [enter image description here][1]dialogView = inflater.inflate(R.layout.dialog_view_popup_layout, null);
    windowManager.addView(dialogView, layoutParams);
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.319867 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO