使用Kotlin编写的流式布局(标签布局),支持设置标签gravity
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.ironbear775:FlowLayout:1.0.0'
}
布局文件中声明,通过flowGravity
设置标签摆放方式,支持start
,center
,end
<com.ironbear775.android.flowlayoutlibrary.FlowLayout
android:id="@+id/flowLayout"
android:layout_height="match_parent"
android:layout_width="match_parent"
app:flowGravity="start" />
代码中设置gravity
flowLayout.setGravity(FlowLayout.START)
flowLayout.setGravity(FlowLayout.CENTER)
flowLayout.setGravity(FlowLayout.END)