Example usage for android.view Window getDecorView

List of usage examples for android.view Window getDecorView

Introduction

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

Prototype

public abstract View getDecorView();

Source Link

Document

Retrieve the top-level window decor view (containing the standard window frame/decorations and the client's content inside of that), which can be added as a window to the window manager.

Usage

From source file:Main.java

@TargetApi(Build.VERSION_CODES.KITKAT)
public static void setImmersiveSticky(Window w) {
    w.getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.KITKAT)
public static void setImmersiveStickyWithActionBar(Window w) {
    w.getDecorView()
            .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

}

From source file:Main.java

public static int getStatusBarHeight(Activity context) {
    Rect rectangle = new Rect();
    Window window = context.getWindow();
    window.getDecorView().getWindowVisibleDisplayFrame(rectangle);
    return rectangle.top;
}

From source file:Main.java

public static int getStatusBarHeight(Activity activity) {
    Rect rect = new Rect();
    Window window = activity.getWindow();
    window.getDecorView().getWindowVisibleDisplayFrame(rect);
    return rect.top;
}

From source file:Main.java

public static int getStatusBarHeight(Activity activity) {
    Rect rectgle = new Rect();
    Window window = activity.getWindow();
    window.getDecorView().getWindowVisibleDisplayFrame(rectgle);
    int StatusBarHeight = rectgle.top;
    return StatusBarHeight;
}

From source file:Main.java

public static boolean isWindowValid(Window paramWindow) {
    return (paramWindow != null) && (paramWindow.getDecorView() != null)
            && (paramWindow.getDecorView().getWindowToken() != null);
}

From source file:Main.java

public static View getActionBarView(Activity activity) {
    Window window = activity.getWindow();
    View v = window.getDecorView();
    //      int resId = activity.getResources().getIdentifier("action_bar_container", "id", "android");
    int resId = activity.getResources().getIdentifier("action_bar_container", "id", activity.getPackageName());
    return v.findViewById(resId);
}

From source file:Main.java

public static int getStatusBarHeight(Activity activity) {

    if (statusBarHeight > 0) {
        return statusBarHeight;
    }/* ww w  . jav  a 2 s  . c  o  m*/
    Rect rectgle = new Rect();
    Window window = activity.getWindow();
    window.getDecorView().getWindowVisibleDisplayFrame(rectgle);
    statusBarHeight = rectgle.top;
    return statusBarHeight;

}

From source file:Main.java

public static int getStatusBarHeight(Context context) {
    Rect rectgle = new Rect();
    Window window = ((Activity) context).getWindow();
    window.getDecorView().getWindowVisibleDisplayFrame(rectgle);
    return rectgle.top;
}

From source file:Main.java

/**
 * Returns the view container for the ActionBar.
 *
 * @return/*from  w w w  . j a  v a2s.  com*/
 */
public static View getActionBarView(Activity activity) {
    Window window = activity.getWindow();
    View view = window.getDecorView();
    int resId = activity.getResources().getIdentifier("action_bar_container", "id", "android");

    return view.findViewById(resId);
}