How to programmatically set weight for Button
You can pass it in as part of the LinearLayout.LayoutParams constructor: Did you mean wrap_content?
LayoutParams param = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT, 1.0f);
1.0f is the weight
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
p.weight = 1;
rangeSeekBar.setLayoutParams(p);
I'm not sure which view you want to set the layout params on. I just assumed the rangeSeekbar to show an example. Change if you need.
When using the layout params always use the root's param type..
Ex. if you have a View
you want to apply params to within a RelativeLayout
use RelativeLayout.LayoutParams
..