这里在时给出了四种情况的用例:
(一)文字统一高度,也就是默认的情况
(二)不同高度的文本,没设置居中显示的情况
不同高度的文本,没设置居中显示的情况.gif这里详见:
(三)不同高度的文本,设置居中显示的情况
(四)规定行数的流式布局
属性:
<declare-styleable name="FlowLayout">
<!--文本是否居中-->
<attr name="is_line_center" format="boolean" />
</declare-styleable>
<declare-styleable name="LineFlowLayout">
<!--规定行数-->
<attr name="flow_line_count" format="integer" />
</declare-styleable>
<declare-styleable name="ScrollFlowLayout">
<!--上边界阴影颜色-->
<attr name="effect_top_color" format="color" />
<!--下边界阴影颜色-->
<attr name="effect_bottom_color" format="color" />
<!--滑动到顶部或底部是否需要阴影效果-->
<attr name="need_effect" format="boolean" />
</declare-styleable>
gradle依赖
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
compile 'com.github.1002326270xc:FlowView-master:v1.1'
}
后期添加(自带滑动结构的流式布局):
自带滑动结构的流式布局.gif