You are create when Dynamically button then set weight without use xml.
then use it this code
LinearLayout.LayoutParams size = new LinearLayout.LayoutParams
(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
size.weight = 1;
Button btn = new Button(MainActivity.this);
btn.setLayoutParams(size);
You have to use TableLayout.LayoutParams
TextView tv = new TextView(v.getContext());
tv.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT, 1f));
thanks
ReplyDeletehttps://www.facebook.com/groups/dandroid/689724367728314/?ref=notif¬if_t=like