FlowLayout是自定义ViewGroup,实现了流式布局,自动换行的功能,并且可以控制最大行数,设置水平间距,垂直间距和子View垂直居中。
github地址
效果图:
使用方法:
<com.ayy.flowlayout.FlowLayout
android:id="@+id/flow_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:horizontal_space="10dp" //水平间距
app:vertical_space="10dp" //垂直间距
app:max_line="3" //控制行数
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
</com.ayy.flowlayout.FlowLayout
<com.ayy.flowlayout.FlowLayout
android:id="@+id/flow_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:horizontal_space="10dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:max_line="3"
app:vertical_space="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="哈哈" />
</com.ayy.flowlayout.FlowLayout>
TextView textView = new TextView(this);
flowLayout.addView(textView);
本文地址:https://blog.csdn.net/anyanyan07/article/details/107125642
如对本文有疑问, 点击进行留言回复!!
Error running app: Default Activity Not Found
如何用HMS Nearby Service给自己的App添加近距离数据传输功能
BlockChain:2020年7月10日世界人工智能大会WAIC《链智未来 赋能产业区块链主题论坛》(四)
网友评论