LayoutLib: Fix some rendering issues
Change-Id: I662a39a783de5bc7f3063f46cedaab11c7e6496e
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index 4220ddd..bb4c56c 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -413,6 +413,9 @@
ResourceValue item = mRenderResources.findResValue(customStyle,
false /*forceFrameworkOnly*/);
+ // resolve it in case it links to something else
+ item = mRenderResources.resolveResValue(item);
+
if (item instanceof StyleResourceValue) {
defStyleValues = (StyleResourceValue)item;
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
index fa04697..c8ad1d6 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
@@ -361,9 +361,6 @@
View view = mInflater.inflate(mBlockParser, mViewRoot);
- // post-inflate process. For now this supports TabHost/TabWidget
- postInflateProcess(view, mParams.getProjectCallback());
-
Fragment_Delegate.setProjectCallback(null);
// set the AttachInfo on the root view.
@@ -375,6 +372,9 @@
info.mHardwareAccelerated = false;
mViewRoot.dispatchAttachedToWindow(info, 0);
+ // post-inflate process. For now this supports TabHost/TabWidget
+ postInflateProcess(view, mParams.getProjectCallback());
+
// get the background drawable
if (mWindowBackground != null) {
Drawable d = ResourceHelper.getDrawable(mWindowBackground,
@@ -461,13 +461,14 @@
// remeasure with the size we need
// This must always be done before the call to layout
w_spec = MeasureSpec.makeMeasureSpec(mMeasuredScreenWidth, MeasureSpec.EXACTLY);
- h_spec = MeasureSpec.makeMeasureSpec(mMeasuredScreenHeight,
- MeasureSpec.EXACTLY);
+ h_spec = MeasureSpec.makeMeasureSpec(mMeasuredScreenHeight, MeasureSpec.EXACTLY);
mViewRoot.measure(w_spec, h_spec);
// now do the layout.
mViewRoot.layout(0, 0, mMeasuredScreenWidth, mMeasuredScreenHeight);
+ mViewRoot.mAttachInfo.mTreeObserver.dispatchOnPreDraw();
+
// draw the views
// create the BufferedImage into which the layout will be rendered.
boolean newImage = false;