Skip to content

Commit c679171

Browse files
authored
Preparation for 2.0.0 (#518)
Update README
1 parent 86ed7ce commit c679171

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ Add the following dependency to your `build.gradle` file:
1010

1111
```
1212
dependencies {
13-
implementation 'com.google.android:flexbox:1.1.1'
13+
implementation 'com.google.android:flexbox:2.0.0'
1414
}
1515
```
1616

17+
**Note that the default values for `alignItems` and `alignContent` for `FlexboxLayout` have been changed from `stretch` to `flex_start` starting from 2.0.0, it may break the existing apps.
18+
Please make sure to set `stretch` explicitly if you want to apply the behavior of `stretch`.**
19+
20+
1721
**Note that starting from 1.1.0, the library is expected to use with AndroidX. Please migrate to [AndroidX](https://developer.android.com/jetpack/androidx/migrate) if you use 1.1.0 or above.**
1822

1923
**Please use 1.0.0 if you haven't migrated to AndroidX.**
@@ -162,23 +166,23 @@ Here is a quick overview of the attributes/features comparison between the two i
162166

163167
* __alignItems__
164168
* This attribute controls the alignment along the cross axis. Possible values are:
165-
* stretch (default)
166-
* flex_start
169+
* flex_start (default)
167170
* flex_end
168171
* center
169172
* baseline
173+
* stretch
170174

171175
![Align Items explanation](/assets/align-items.gif)
172176

173177
* __alignContent__
174178
* This attribute controls the alignment of the flex lines in the flex container. Possible values
175179
are:
176-
* stretch (default)
177-
* flex_start
180+
* flex_start (default)
178181
* flex_end
179182
* center
180183
* space_between
181184
* space_around
185+
* stretch
182186

183187
![Align Content explanation](/assets/align-content.gif)
184188

@@ -369,6 +373,9 @@ equivalent attribute
369373
but as explained above, Android developers will benefit by having this attribute for having
370374
more control over when a wrapping happens.
371375

376+
(5) Default values for `alignItems` and `alignContent` are set to `flex_start` instead of `stretch`.
377+
* Setting `stretch` for the `alignItems` is expensive because the children of `FlexboxLayout` are calculated more than twice. The difference is more obvious when the layout hierarchy is deeply nested.
378+
372379
## Xamarin Binding
373380
Xamarin binding is now available on [NuGet](https://www.nuget.org/packages/FlexboxLayoutXamarinBindingAndroid/) thanks to [@btripp](https://github.com/btripp)
374381

flexbox/constants.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ext {
2222

2323
mavenGroup = 'com.google.android'
2424
mavenArtifactId = 'flexbox'
25-
mavenVersion = '1.1.1'
25+
mavenVersion = '2.0.0'
2626

2727
bintrayOrg = 'google'
2828
}

0 commit comments

Comments
 (0)