android Layout weight programmatically
Something like this:
......
LinearLayout layout = (LinearLayout)findViewById(YOUR_LAYOT_ID);
layout.setWeightSum(25f);
LinearLayout.LayoutParams lParams = (LinearLayout.LayoutParams) layout.getLayoutParams(); //or create new LayoutParams...
lParams.weight = 0.5f;
.......
someView.setLayoutParams(lParams);
.......
//set as like this below for different view set different float value.
myview.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,5f));