daemon369 / FlowLayout

Simple flow layout for android. 适用于Android平台的简单的FlowLayout

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FlowLayout

自适应标签容器,支持标签自动换行,支持设置标签水平间距、垂直间距,支持设置最大行数

Download


效果

Demo效果


使用方法

1. 项目中引入依赖:

项目根目录下build.gradle中加入:

allprojects {
    repositories {
        ...
        jcenter()
    }
}

添加依赖:

dependencies {
    implementation 'me.daemon:flowlayout:0.1.0'
}

2. 布局文件中引用:

可以在布局中直接引用:

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="10dp">

    <me.daemon.flowlayout.FlowLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#4bd144"
        android:padding="5dp"
        app:daemon_fl_horizontal_divider_size="5dp"
        app:daemon_fl_max_rows="1"
        app:daemon_fl_vertical_divider_size="5dp">

        <TextView
            android:layout_width="50dp"
            android:layout_height="30dp"
            android:background="@drawable/bg_label"
            android:text="testtestjustt...." />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="50dp"
            android:background="@drawable/bg_label"
            android:text="测试测试测试" />

        <ImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:background="@drawable/bg_label"
            android:src="@mipmap/ic_launcher"
            android:visibility="gone" />

        <TextView
            android:layout_width="90dp"
            android:layout_height="wrap_content"
            android:background="@drawable/bg_label"
            android:text="falefffffffeaf" />

        <ImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:background="@drawable/bg_label"
            android:src="@mipmap/ic_launcher"
            android:visibility="gone" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="70dp"
            android:background="@drawable/bg_label"
            android:text="............................................" />

    </me.daemon.flowlayout.FlowLayout>
</FrameLayout>

About

Simple flow layout for android. 适用于Android平台的简单的FlowLayout

License:Apache License 2.0


Languages

Language:Kotlin 100.0%