自己定义控件-MultipleTextView(自己主动换行、自己主动补齐宽度的排列多个TextView)

一、功能:

1、传入一个 List<String> 数组,控件会自己主动加入TextView,一行显示不下会自己主动换行。而且把上一行末尾的空白通过拉伸而铺满。

2、配置灵活

<com.dd544.bu.MultipleTextView
        xmlns:my="http://schemas.android.com/apk/res-auto"
        android:id="@+id/main_rl"
        android:layout_width="match_parent"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
    	android:layout_height="wrap_content"
    	my:textSize="12sp"
    	my:textWordMargin="10dp"
    	my:textLineMargin="10dp"
    	my:textColor="#ff0000"
    	my:textBackground="@drawable/testd"
    	my:textPaddingLeft="10dp"
    	my:textPaddingRight="10dp"
    	my:textPaddingTop="10dp"
    	my:textPaddingBottom="10dp"
    	/>

能够设置每一个TextView 的字号、颜色、背景、Padding 和 字块之间的margin 、行间距。


二、效果图:



三、源代码:

https://github.com/mentor811/MultipleTextView


【 声明:版权全部。欢迎转载,请勿用于商业用途。

 --天盟】

原文地址:https://www.cnblogs.com/cynchanpin/p/6971703.html