How to set child weight in the code?
I want that button(child) will have 25% of full width of horizontal LinearLayout (its parent). The code:

    LinearLayout ll = new LinearLayout(this);
    ll.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
    ll.setWeightSum (1.0f);

    Button b = new Button (this);
    ll.addView(b);

How can I do it? Thanks.



How to set child weight in the code?
===

I want that button(child) will have 25% of full width of horizontal LinearLayout (its parent). The code:

    LinearLayout ll = new LinearLayout(this);
    ll.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
    ll.setWeightSum (1.0f);

    Button b = new Button (this);
    ll.addView(b);

How can I do it? Thanks.


