SparkleFlowLayout
is based on FlowLayout.
Additional support setting maxLines: when reached the max line, it would be ellipsized, just like TextView's android:ellipsize="end"
- Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add dependency:
dependencies {
implementation 'com.github.sparklexin:sparkle-flowlayout:{latest-version}'
}
<xin.sparkle.flowlayout.SparkleFlowLayout
android:id="@+id/flow_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:sparkleLineSpacing="8dp"
app:sparkleItemSpacing="2dp"
app:sparkleMaxLines="1">
<!-- place your views here or dynamic addView -->
</xin.sparkle.flowlayout.SparkleFlowLayout>
If you need to customize the ellipsize symbol/layout, just use app:sparkleEllipsizeLayout
.
Attribute | Format | Description |
---|---|---|
sparkleLineSpacing | dimension | spacing between rows |
sparkleItemSpacing | dimension | spacing between item views |
sparkleMaxLines | integer | max display rows, the content exceeded would be ellipsized, just like TextView's android:ellipsize="end" |
sparkleEllipsizeLayout | reference | the default ellipsize symbol is … , you can set customized layout. |