explaingit

google/flexbox-layout

18,335KotlinAudience · developerComplexity · 2/5DormantLicenseSetup · easy

TLDR

Android library that brings CSS flexbox layout to mobile apps, letting you arrange items that automatically wrap, grow, and shrink to fit the screen.

Mindmap

mindmap
  root((repo))
    What it does
      Flexbox layouts
      Responsive wrapping
      Item alignment
    Components
      FlexboxLayout view
      FlexboxLayoutManager
      RecyclerView support
    Use cases
      Responsive UIs
      Dynamic lists
      Adaptive screens
    Tech stack
      Kotlin
      Java
      Android

Things people build with this

USE CASE 1

Build responsive Android layouts that automatically wrap items to new lines based on screen size.

USE CASE 2

Create scrollable lists with flexible item sizing using RecyclerView without writing custom layout logic.

USE CASE 3

Design adaptive UIs where buttons, cards, or images grow and shrink to fill available space.

Tech stack

KotlinJavaAndroid

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

FlexboxLayout is a Kotlin/Java library for Android that brings the flexible box layout model, a system originally from web CSS, to Android applications. Flexbox is a way to arrange items in a container so that they can grow, shrink, and wrap onto new lines in a controlled way, making it easier to build responsive layouts without hard-coding exact positions. The library provides two ways to use it. The first is FlexboxLayout, a view container that works like Android's built-in LinearLayout or RelativeLayout, where you define the layout in XML or code and items are arranged at once. The second is FlexboxLayoutManager, which is designed to work inside a RecyclerView, Android's component for displaying long scrollable lists. Using FlexboxLayoutManager has the advantage of recycling off-screen views for reuse as the user scrolls, which uses significantly less memory when displaying many items. Both approaches support the main flexbox attributes such as controlling the direction items flow, whether items wrap to new lines, how items are aligned along both axes, and how individual items can grow or shrink relative to their siblings. The library is installed as a dependency via a build configuration file.

Copy-paste prompts

Prompt 1
Show me how to set up FlexboxLayout in an Android XML layout file to create a wrapping row of buttons.
Prompt 2
How do I use FlexboxLayoutManager with RecyclerView to display a grid of items that wraps responsively?
Prompt 3
What flexbox attributes control how items align and distribute space in a FlexboxLayout container?
Prompt 4
Give me a code example of using FlexboxLayout to build a responsive tag cloud that wraps on smaller screens.
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.