Example usage for android.view ViewGroup setClipToPadding

List of usage examples for android.view ViewGroup setClipToPadding

Introduction

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

Prototype

public void setClipToPadding(boolean clipToPadding) 

Source Link

Document

Sets whether this ViewGroup will clip its children to its padding and resize (but not clip) any EdgeEffect to the padded region, if padding is present.

Usage

From source file:Main.java

public static void disableParentsClip(@NonNull View view) {
    while (view.getParent() != null && view.getParent() instanceof ViewGroup) {
        ViewGroup viewGroup = (ViewGroup) view.getParent();
        viewGroup.setClipChildren(false);
        viewGroup.setClipToPadding(false);
        view = viewGroup;/*from w  w w.j  a va2  s.  c  o m*/
    }
}

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 ww .  jav  a 2  s  . c  o m*/
        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 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);
}

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 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 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);
}

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

/**
 *  DrawerLayout ???(5.0??,?)//from   w w w.j  av  a2 s .  c o  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

/**
 * ?//from w w  w  .ja va  2s  .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 w w w  .  ja  v a  2s.co  m*/
 */
@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);
}