How to set height of any component in building extension?
package com.faraz.ListWithImageAndText;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.errors.YailRuntimeError;
import com.google.appinventor.components.runtime.util.YailList;
import com.google.appinventor.components.runtime.HVArrangement;
import android.widget.ListView;
import android.view.View;
import android.widget.FrameLayout;
public class ListWithImageAndText extends AndroidNonvisibleComponent {
public ComponentContainer container;
public View v;
public ListWithImageAndText(ComponentContainer container) {
super(container.$form());
this.container = container;
}
@SimpleFunction(description = "Creates list with image and text in the arrangement that you give")
public void Create(HVArrangement createIn){
View view = createIn.getView();
FrameLayout frameLayout = (FrameLayout) view;
ListView listView = new ListView(this.container.$context());
v = (listView);
frameLayout.addView(listView, new FrameLayout.LayoutParams(-1, -1));
}
@SimpleProperty(description = "Set height of List with image and text -1 = automatic, -2 = fill parent")
public void Height(int height){
v.setHeight(height);
}
}
Compiling Java files
│ warning: The following options were not recognized by any processor: '[output, org, root, version, extName]'
│
│ ERR src\com\faraz\ListWithImageAndText\ListWithImageAndText.java:56: error: cannot find symbol
│ v.setHeight(height);
│ ^
│ symbol: method setHeight(int)
│ location: variable v of type View
│
│ Total error(s): 1
└ Failed
• Build failed [6s 118ms]