Skip to content

Instantly share code, notes, and snippets.

@chrisbanes
Created June 11, 2013 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisbanes/5755022 to your computer and use it in GitHub Desktop.
Save chrisbanes/5755022 to your computer and use it in GitHub Desktop.
DecorChildLayout(Context context, ViewGroup systemDecorView, View headerView) {
super(context);
// Move all children from decor view to here
for (int i = 0, z = systemDecorView.getChildCount() ; i < z ; i++) {
View child = systemDecorView.getChildAt(i);
systemDecorView.removeView(child);
addView(child);
}
/**
* Wrap the Header View in a FrameLayout and add it to this view. It is wrapped
* so any inset changes do not affect the actual header view.
*/
mHeaderViewWrapper = new FrameLayout(context);
mHeaderViewWrapper.addView(headerView);
addView(mHeaderViewWrapper, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
requestFitSystemWindows();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment