I have the following code to try and set the weight of a linearLayout to 0.7, after looking at the documentation and some examples online it says it takes 3 parameters but in my code it will not let me:
LinearLayout linear = new LinearLayout(this);
linear.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
So here it sets both the height and the width but the last parameter it says in the documentation is the weight and it wont let me put it in there.
Try this for the layoutparams for linearlayout:
As a proof-of-concept: this works. check out the import and compare them with your own 🙂
file: Test.java