Example usage for android.view Window getWindowManager

List of usage examples for android.view Window getWindowManager

Introduction

In this page you can find the example usage for android.view Window getWindowManager.

Prototype

public WindowManager getWindowManager() 

Source Link

Document

Return the window manager allowing this Window to display its own windows.

Usage

From source file:android.support.v17.leanback.app.BackgroundManager.java

private void attachBehindWindow(Window window) {
    if (DEBUG)//  www .  j a  v a  2 s .  c  om
        Log.v(TAG, "attachBehindWindow " + window);
    mWindow = window;
    mWindowManager = window.getWindowManager();

    WindowManager.LayoutParams params = new WindowManager.LayoutParams(
            // Media window sits behind the main application window
            WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA,
            // Avoid default to software format RGBA
            WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, android.graphics.PixelFormat.TRANSLUCENT);
    params.setTitle(WINDOW_NAME);
    params.width = ViewGroup.LayoutParams.MATCH_PARENT;
    params.height = ViewGroup.LayoutParams.MATCH_PARENT;

    View backgroundView = LayoutInflater.from(mContext).inflate(R.layout.lb_background_window, null);
    mWindowManager.addView(backgroundView, params);

    attachToView(backgroundView);
}