Android Studio Set Weight Layout Programatically


LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, //OR WRAP_CONTENT -> layout_width
LayoutParams.MATCH_PARENT, //OR WRAP_CONTENT -> layout_height
1.0f // layout_weight 1
);
YOUR_VIEW.setLayoutParams(param);