Yairopro
Yairopro

Reputation: 10358

Android Google FlexboxLayout : get lines or columns number

I am using the Google's FlexboxLayout Android library.

I'm searching how to get the number of rows (when the flexDirection property is set to row or row_reverse) or columns (when the flexDirection property is set to column or column_reverse).

Upvotes: 3

Views: 3446

Answers (1)

Yairopro
Yairopro

Reputation: 10358

The method FlexboxLayout.getFlexLines() returns a list of instances of com.google.android.flexbox.FlexLine, each holds properties related to a a line on the main axis of the FlexBoxLayout. I just have to retrieve the size of the list to get the number of lines on the main axis.

Note that FlexboxLayout.getFlexLines() returns the number of actual lines -1.

Upvotes: 3

Related Questions