SessionParams params = getParams();
BridgeContext context = getContext();
+ // the view group that receives the window background.
+ ViewGroup backgroundView = null;
+
if (mWindowIsFloating || params.isForceNoDecor()) {
- mViewRoot = mContentRoot = new FrameLayout(context);
+ backgroundView = mViewRoot = mContentRoot = new FrameLayout(context);
} else {
/*
* we're creating the following layout
+-------------------------------------------------+
| System bar (only in phone UI) |
+-------------------------------------------------+
- | Title/Action bar (optional) |
- +-------------------------------------------------+
- | Content, vertical extending |
- | |
+ | (Layout with background drawable) |
+ | +---------------------------------------------+ |
+ | | Title/Action bar (optional) | |
+ | +---------------------------------------------+ |
+ | | Content, vertical extending | |
+ | | | |
+ | +---------------------------------------------+ |
+-------------------------------------------------+
| System bar (only in tablet UI) |
+-------------------------------------------------+
}
}
+ LinearLayout backgroundLayout = new LinearLayout(context);
+ backgroundView = backgroundLayout;
+ backgroundLayout.setOrientation(LinearLayout.VERTICAL);
+ LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
+ LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
+ layoutParams.weight = 1;
+ backgroundLayout.setLayoutParams(layoutParams);
+ topLayout.addView(backgroundLayout);
+
+
// if the theme says no title/action bar, then the size will be 0
if (mActionBarSize > 0) {
try {
actionBar.setLayoutParams(
new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, mActionBarSize));
- topLayout.addView(actionBar);
+ backgroundLayout.addView(actionBar);
} catch (XmlPullParserException e) {
}
titleBar.setLayoutParams(
new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, mTitleBarSize));
- topLayout.addView(titleBar);
+ backgroundLayout.addView(titleBar);
} catch (XmlPullParserException e) {
}
// content frame
mContentRoot = new FrameLayout(context);
- LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
+ layoutParams = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
layoutParams.weight = 1;
mContentRoot.setLayoutParams(layoutParams);
- topLayout.addView(mContentRoot);
+ backgroundLayout.addView(mContentRoot);
if (mSystemBarSize > 0) {
// system bar
}
}
-
}
postInflateProcess(view, params.getProjectCallback());
// get the background drawable
- if (mWindowBackground != null) {
+ if (mWindowBackground != null && backgroundView != null) {
Drawable d = ResourceHelper.getDrawable(mWindowBackground, context);
- mContentRoot.setBackgroundDrawable(d);
+ backgroundView.setBackgroundDrawable(d);
}
return SUCCESS.createResult();