diff options
author | Xavier Ducrohet <xav@android.com> | 2010-11-19 13:54:48 -0800 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2010-11-19 14:18:55 -0800 |
commit | 018f0ada85957d49db115b11dd630b2e94f9fdfb (patch) | |
tree | 7e173ccd58484bcf214e1ac803994a90bcd1cb92 /eclipse/plugins/com.android.ide.eclipse.adt/src/com | |
parent | d59c1f5ad1dc6219fd901940a8c40f320dad5685 (diff) | |
download | sdk-018f0ada85957d49db115b11dd630b2e94f9fdfb.zip sdk-018f0ada85957d49db115b11dd630b2e94f9fdfb.tar.gz sdk-018f0ada85957d49db115b11dd630b2e94f9fdfb.tar.bz2 |
ADT/Layoutlib: update API to control how layout expands.
Previous API was a single on/off to let the layouts expand at
render time depending on how much space they needed.
The new API can now control expansion is horizontal and/or
vertical (or not at all)
Basic implementation in the editor, with a manual detect of
"ScrollView" as top element. We should make the ViewRule handle
this somehow.
Change-Id: Idc503bc0d1d3df98fbf01cc84625952ca55a8afb
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/src/com')
-rwxr-xr-x | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java index 728c089..f04fcc1 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java @@ -52,6 +52,7 @@ import com.android.layoutlib.api.LayoutBridge; import com.android.layoutlib.api.LayoutScene; import com.android.layoutlib.api.SceneParams; import com.android.layoutlib.api.SceneResult; +import com.android.layoutlib.api.SceneParams.RenderingMode; import com.android.sdklib.IAndroidTarget; import com.android.sdklib.SdkConstants; import com.android.sdkuilib.internal.widgets.ResolutionChooserDialog; @@ -1322,10 +1323,23 @@ public class GraphicalEditorPart extends EditorPart UiElementPullParser parser = new UiElementPullParser(model, mUseExplodeMode, explodeNodes, density, xdpi, iProject); + RenderingMode renderingMode = RenderingMode.NORMAL; + if (mClippingButton.getSelection() == false) { + renderingMode = RenderingMode.FULL_EXPAND; + } else { + // FIXME set the rendering mode using ViewRule or something. + List<UiElementNode> children = model.getUiChildren(); + if (children.size() > 0 && + children.get(0).getDescriptor().getXmlLocalName().equals("ScrollView")) { + renderingMode = RenderingMode.V_SCROLL; + } + } + SceneParams params = new SceneParams( parser, iProject /* projectKey */, - width, height, !mClippingButton.getSelection(), + width, height, + renderingMode, density, xdpi, ydpi, theme, isProjectTheme, configuredProjectRes, frameworkResources, mProjectCallback, |