/** * Scrollable property setter method. * * @param scrollable true if the screen should be vertically scrollable */ @DesignerProperty(editorType = DesignerProperty.PROPERTY_TYPE_BOOLEAN, defaultValue = "True") @SimpleProperty public void Scrollable(boolean scrollable) { if (this.scrollable == scrollable && frameLayout != null) { return; } // Remove our view from the current frameLayout. if (frameLayout != null) { frameLayout.removeAllViews(); } this.scrollable = scrollable; frameLayout = scrollable ? new ScrollView(this) : new FrameLayout(this); frameLayout.addView( viewLayout.getLayoutManager(), new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); frameLayout.setBackgroundColor(backgroundColor); if (backgroundDrawable != null) { ViewUtil.setBackgroundImage(frameLayout, backgroundDrawable); } setContentView(frameLayout); frameLayout.requestLayout(); }
/** * Specifies the path of the background image. * * <p>See {@link MediaUtil#determineMediaSource} for information about what a path can be. * * @param path the path of the background image */ @DesignerProperty(editorType = DesignerProperty.PROPERTY_TYPE_ASSET, defaultValue = "") @SimpleProperty( category = PropertyCategory.APPEARANCE, description = "The screen background image.") public void BackgroundImage(String path) { backgroundImagePath = (path == null) ? "" : path; try { backgroundDrawable = MediaUtil.getDrawable(this, backgroundImagePath); } catch (IOException ioe) { Log.e(LOG_TAG, "Unable to load " + backgroundImagePath); backgroundDrawable = null; } ViewUtil.setBackgroundImage(frameLayout, backgroundDrawable); frameLayout.invalidate(); }
@Override public void setChildHeight(AndroidViewComponent component, int height) { // A form is a vertical layout. ViewUtil.setChildHeightForVerticalLayout(component.getView(), height); }
@Override public void setChildWidth(AndroidViewComponent component, int width) { // A form is a vertical layout. ViewUtil.setChildWidthForVerticalLayout(component.getView(), width); }