Example usage for android.view ViewGroup setFitsSystemWindows

List of usage examples for android.view ViewGroup setFitsSystemWindows

Introduction

In this page you can find the example usage for android.view ViewGroup setFitsSystemWindows.

Prototype

public void setFitsSystemWindows(boolean fitSystemWindows) 

Source Link

Document

Sets whether or not this view should account for system screen decorations such as the status bar and inset its content; that is, controlling whether the default implementation of #fitSystemWindows(Rect) will be executed.

Usage

From source file:Main.java

public static void setTranslucentForDrawerLayoutHalf(Activity activity, DrawerLayout drawerLayout) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
        contentLayout.setFitsSystemWindows(true);
        contentLayout.setClipToPadding(true);
        ViewGroup vg = (ViewGroup) drawerLayout.getChildAt(1);
        vg.setFitsSystemWindows(false);/*  w w w  .java 2  s  . com*/
        drawerLayout.setFitsSystemWindows(false);
    }
}

From source file:Main.java

private static void setRootView(Activity activity) {
    ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
    rootView.setFitsSystemWindows(true);
    rootView.setClipToPadding(true);//from ww w  .j  av a 2  s  . c  o m
}

From source file:Main.java

public static void setRootView(Activity activity, boolean fitsSystemWindows) {
    ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
    rootView.setFitsSystemWindows(fitsSystemWindows);
    rootView.setClipToPadding(fitsSystemWindows);
}

From source file:Main.java

public static void setRootView(Activity activity) {
    ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
    rootView.setFitsSystemWindows(true);
    rootView.setClipToPadding(true);//  w  w w. j a  va  2s .  c  o  m
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private static void setRootView(Activity activity) {
    ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
    rootView.setFitsSystemWindows(true);
    rootView.setClipToPadding(true);//from w w w  . j a va  2  s.  c  o  m
}

From source file:Main.java

public static void setFitsSystemWindows(Activity activity, boolean values) {
    ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
    Log.d("statusbar", "rootViewid  " + rootView.getId());
    rootView.setFitsSystemWindows(values);
    rootView.setClipToPadding(true);/*w  w  w. java2s  .  c om*/
}

From source file:edu.com.mvplibrary.ui.widget.StatusBarUtil.java

/**
 *  DrawerLayout ???(5.0??,?)/*from w  ww.  ja va2s.  co  m*/
 *
 * @param activity     ?activity
 * @param drawerLayout DrawerLayout
 */
public static void setTranslucentForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        // ???
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        // 
        ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
        contentLayout.setFitsSystemWindows(true);
        contentLayout.setClipToPadding(true);
        // 
        ViewGroup vg = (ViewGroup) drawerLayout.getChildAt(1);
        vg.setFitsSystemWindows(false);
        //  DrawerLayout 
        drawerLayout.setFitsSystemWindows(false);
    }
}

From source file:edu.com.mvplibrary.ui.widget.StatusBarUtil.java

/**
 * ?//ww w.  j av a 2 s .  c o  m
 */
private static void setRootView(Activity activity) {
    ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
    rootView.setFitsSystemWindows(true);
    rootView.setClipToPadding(true);
}

From source file:com.gosuncn.core.util.view.StatusBarUtils.java

/**
 * ?//from  www  .  ja va 2s  .c  om
 */
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private static void setRootView(Activity activity) {
    ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
    rootView.setFitsSystemWindows(true);
    rootView.setClipToPadding(true);
}

From source file:org.huxizhijian.sdk.util.StatusBarUtil.java

/**
 *  DrawerLayout ???(5.0??,?)/*from   w  ww  .j  a v a 2  s . com*/
 *
 * @param activity     ?activity
 * @param drawerLayout DrawerLayout
 */
@Deprecated
public static void setTranslucentForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        // ???
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        // 
        ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
        contentLayout.setFitsSystemWindows(true);
        contentLayout.setClipToPadding(true);
        // 
        ViewGroup vg = (ViewGroup) drawerLayout.getChildAt(1);
        vg.setFitsSystemWindows(false);
        //  DrawerLayout 
        drawerLayout.setFitsSystemWindows(false);
    }
}