Android Flexbox setFlexBasisPercent not working

1.1k Views Asked by At

I'm using android's now layout - FlexboxLayout. When I add some view to FlexboxLayout programmatically,
FlexboxLayout.setWidth( int ) is working but FlexboxLayout.setFlexBasisPercent( float ) not. Why!!! I can't understand. Here is my code.

enter image description here

------------- I Find Answer!!! 2017/07/30/11:59

my mistake is that

lp.setFlexBasisPercent(10)

FlexboxLayout.setFlexBasisPercent(0.1f) was right!!!

1

There are 1 best solutions below

2
On BEST ANSWER

Documentation on Flexbox is scarce, but from what im gathering, the parent element has to have a defined width/height in order for that to work. Here is a quote.

This attribute is only effective when the parent's length is definite (MeasureSpec mode is MeasureSpec.EXACTLY) https://github.com/google/flexbox-layout