Android: FlexBoxLayout

Updated 21 December 2016

Save

A FlexBoxLayout (Flexible box layout) in android is similar to the one in CSS. Its work is to make a layout flexible. As you know the android have limited screen size so sometimes the length of the data increases throwing our views out. In vertical layout it can be solved with applying a parent ScrollView but things got really weird with Horizontal Layouts. Then there comes the FlexBoxLayout to our rescue.

The FlexBoxLayout contains many properties like flex direction, flex_wrap, justifyContent and many more. But I am especially using the flex_wrap property as it let me put any number of views in horizontal layout. It wraps the horizontal content such that if there is no space it will go to next line. Isn’t it great?

for using FlexBoxlayout you have to add a dependency to your project

And then you can use it anywhere like I used it add a address in my view such that

And with that you got what actually you wanted. As I had already said it has many more properties its just a demo. You can check more here.

Source: https://github.com/google/flexbox-layout

UI
author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home