I want to put fixed-dimension buttons centred in a layout so that they automatically go to the next line when they are too many. But I know that this behaviour doesn't work with LinearLayout.
Do you have an idea on how I can proceed?
Here is the behaviour that I would like:
The Flexbox library from Google does exactly this:
Add the dependency to app/build.gradle:
dependencies {
implementation 'com.google.android:flexbox:2.0.1'
}
Usage of the layout:
<com.google.android.flexbox.FlexboxLayout
app:flexWrap="wrap">
<View/>
<View/>
<View/>
<View/>
</com.google.android.flexbox.FlexboxLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With