Last active
December 18, 2015 22:49
-
-
Save goncalossilva/5856947 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyDrawerLayout extends DrawerLayout { | |
// ... | |
@Override | |
public void addView(View child, int index, ViewGroup.LayoutParams params) { | |
if(child instanceof ViewGroup) { | |
ViewGroup childVG = (ViewGroup)child; | |
if(childVG.getBackground() == null && childVG.getChildCount() == 1) { | |
View realChild = childVG.getChildAt(0); | |
ViewGroup.LayoutParams lp = realChild.getLayoutParams(); | |
if(realChild.getBackground() != null | |
&& lp.width == ViewGroup.LayoutParams.MATCH_PARENT | |
&& lp.height == ViewGroup.LayoutParams.MATCH_PARENT) { | |
child.setBackgroundDrawable(realChild.getBackground()); | |
realChild.setBackgroundDrawable(null); | |
} | |
} | |
} | |
super.addView(child, index, params); | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment