Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nex3z/FlowLayout
A flow layout for Android with auto-spacing.
https://github.com/nex3z/FlowLayout
android-library flowlayout
Last synced: about 1 month ago
JSON representation
A flow layout for Android with auto-spacing.
- Host: GitHub
- URL: https://github.com/nex3z/FlowLayout
- Owner: nex3z
- License: apache-2.0
- Created: 2017-01-03T14:02:06.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-30T16:36:41.000Z (over 3 years ago)
- Last Synced: 2024-11-05T03:51:28.778Z (about 1 month ago)
- Topics: android-library, flowlayout
- Language: Java
- Homepage:
- Size: 349 KB
- Stars: 2,426
- Watchers: 44
- Forks: 289
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-github-android-ui - FlowLayout - 让子视图自动浮动到下一行 (TagView)
README
# FlowLayout
A FlowLayout for Android, which allows child views flow to next row when there is no enough space. The spacing between child views can be calculated by the FlowLayout so that the views are evenly placed.
## Gradle
AndroidX:
```
implementation 'com.nex3z:flow-layout:1.3.3'
```AppCompact:
```
implementation 'com.nex3z:flow-layout:1.2.4'
```## Usage
```xml
```
## Attributes
| Attribute | Format | Description |
|--------------------------|------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| flFlow | boolean | `true` to allow flow. `false` to restrict all child views in one row. The default is `true`. |
| flChildSpacing | `auto`/dimension | The horizontal spacing between child views. Either `auto`, or a fixed size. The default is 0dp. |
| flChildSpacingForLastRow | `auto`/`align`/
dimension | The horizontal spacing between child views of the last row. Either `auto`, `align` or a fixed size. If not set, `childSpacing` will be used instead. |
| flRowSpacing | `auto`/dimension | The vertical spacing between rows. Either `auto`, or a fixed size. The default is 0dp. |
| flRtl | boolean | `true` to layout child views from right to left. `false` to layout from left to right. The default is `false`. |
| flMaxRows | integer | The maximum height of FlowLayout in terms of number of rows. |`auto` means that the actual spacing is calculated as per the size of the `FlowLayout` and the number of child views (or rows), so that the child views (or rows) are placed evenly.
`align` in `childSpacingForLastRow` means that the horizontal spacing of the child views in the last row keeps the same with the spacing used in the row above. If there is only one row in `FlowLayout` and the `childSpacingForLastRow` is set to `align`, this value is ignored and the actual spacing is calculated using `childSpacing`.
## Licence
```
Copyright 2016 nex3zLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```