@@ -40,13 +40,17 @@ public void onPostCreate(Bundle savedInstanceState) {
40
40
41
41
mOnPostCreateCalled = true ;
42
42
43
+ // get the window background
44
+ TypedArray a = mActivity .getTheme ().obtainStyledAttributes (new int [] {android .R .attr .windowBackground });
45
+ int background = a .getResourceId (0 , 0 );
46
+
43
47
if (mEnableSlide ) {
44
48
mSlidingMenu .setFitsSystemWindows (true );
45
49
// move everything into the SlidingMenu
46
50
ViewGroup decor = (ViewGroup ) mActivity .getWindow ().getDecorView ();
47
51
ViewGroup decorChild = (ViewGroup ) decor .getChildAt (0 );
48
- TypedArray a = mActivity . getTheme (). obtainStyledAttributes ( new int [] { android . R . attr . windowBackground });
49
- decorChild .setBackgroundResource (a . getResourceId ( 0 , 0 ) );
52
+ // save ActionBar themes that have transparent assets
53
+ decorChild .setBackgroundResource (background );
50
54
decor .removeView (decorChild );
51
55
mSlidingMenu .setViewAbove (decorChild );
52
56
decor .addView (mSlidingMenu );
@@ -56,8 +60,12 @@ public void onPostCreate(Bundle savedInstanceState) {
56
60
if (parent != null ) {
57
61
parent .removeView (mViewAbove );
58
62
}
63
+ // save people from having transparent backgrounds
64
+ if (mViewAbove .getBackground () == null ) {
65
+ mViewAbove .setBackgroundResource (background );
66
+ }
59
67
mSlidingMenu .setViewAbove (mViewAbove );
60
- mActivity . getWindow (). setContentView ( mSlidingMenu );
68
+ parent . addView ( mSlidingMenu , new LayoutParams ( LayoutParams . FILL_PARENT , LayoutParams . FILL_PARENT ) );
61
69
}
62
70
}
63
71
0 commit comments