美文网首页安卓开发
安卓流式布局FlowLayout样例

安卓流式布局FlowLayout样例

作者: 蓝不蓝编程 | 来源:发表于2020-10-20 19:20 被阅读0次

    用途

    让布局里的控件自动换行

    效果图

    使用方法

    1. 添加依赖
    implementation 'com.nex3z:flow-layout:1.3.1'
    
    1. 代码
    <com.nex3z.flowlayout.FlowLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="@drawable/shape_rec_blue"
            android:padding="10dp"
            android:text="@string/test" />
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="@drawable/shape_rec_blue"
            android:padding="10dp"
            android:text="@string/test" />
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="@drawable/shape_rec_blue"
            android:padding="10dp"
            android:text="@string/test" />
    </com.nex3z.flowlayout.FlowLayout>
    

    完整源代码

    https://gitee.com/cxyzy1/flow-layout-demo

    相关文章

      网友评论

        本文标题:安卓流式布局FlowLayout样例

        本文链接:https://www.haomeiwen.com/subject/ddtjmktx.html