I’m trying to create LinearLayout with 2 children LinearLayouts. I can’t use XML and should make this programmatically.
For parent I apply:
<code>LayoutParams(MATCH_PARENT, WRAP_CONTENT, 1f)
</code>
<code>LayoutParams(MATCH_PARENT, WRAP_CONTENT, 1f)
</code>
LayoutParams(MATCH_PARENT, WRAP_CONTENT, 1f)
1st child:
<code>LayoutParams(MATCH_PARENT, WRAP_CONTENT, 0.3f)
</code>
<code>LayoutParams(MATCH_PARENT, WRAP_CONTENT, 0.3f)
</code>
LayoutParams(MATCH_PARENT, WRAP_CONTENT, 0.3f)
2nd child:
<code>LayoutParams(MATCH_PARENT, WRAP_CONTENT, 0.7f)
</code>
<code>LayoutParams(MATCH_PARENT, WRAP_CONTENT, 0.7f)
</code>
LayoutParams(MATCH_PARENT, WRAP_CONTENT, 0.7f)
I expected child 2 to be bigger than child 1, but they’re inverted. Child 1 takes more space than child 2.
Why I get this behaviour and how to fix it?