I am creating an extension in which i need to set button width and height
but problem is that it is not working . it is taking full parent in arrangement
i tried by two codes
button.setWidth(width);
button.setHeight(height);
and other one
myButton.setText(text);
android.widget.LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(width , height);
myButton.setLayoutParams(lp);
but not working
can anyone give me correct snippet?
@SimpleFunction(description="Add A Button")
public void AddButton(int id , String text , int width , int height){
ViewGroup myViewGroup = (ViewGroup)layout.getView();
Button myButton = new Button(activity);
myButton.setId(id);
myButton.setText(text);
android.widget.LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(width , height);
myButton.setLayoutParams(lp);
myViewGroup.addView(myButton);
}