Skip to content

sparklexin/sparkle-flowlayout

Repository files navigation

SparkleFlowLayout

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"

Gradle

  1. Add it in your root build.gradle at the end of repositories:
allprojects {
   repositories {
	 ...
	 maven { url 'https://jitpack.io' }
   }
}
  1. Add dependency:
dependencies {
   implementation 'com.github.sparklexin:sparkle-flowlayout:{latest-version}'
}

Usage

<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.

Attributes

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.

About

支持设置最大行数,超出...截断的ViewGroup

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages