In HVArrangement:
You need to specify container, orientation and scrollable.
Therefore,
import android.content.Context;
import android.util.Log;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.runtime.*;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.common.ComponentConstants;
import android.view.View;
@DesignerComponent(version = 1, description = " made by Soham Shah",
category = ComponentCategory.EXTENSION,
nonVisible = true, iconName = "http://yusufcihan.com/img/favicon.png")
@SimpleObject(external = true)
public class DynamicArrangements extends AndroidNonvisibleComponent {
private ComponentContainer container;
/**
* @param container container, component will be placed in
*/
public DynamicArrangements(ComponentContainer container) {
super(container.$form());
this.container = container;
}
@SimpleFunction(description = "Creates a dynamic arrangement in selected arrangement.")
public void CreateArrangement(AndroidViewComponent component) {
new HVArrangement((ComponentContainer)component, LAYOUT_ORIENTATION_HORIZONTAL /*or LAYOUT_ORIENTATION_VERTICAL*/, true //or false depends on scrollable or not)
}
Note
- Constant of orientation:
static final int LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL; //0
static final int LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL; //1