您的位置:首页 > 其它

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

2014-06-01 16:22 351 查看

一、功能:

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

【 声明:版权所有,欢迎转载,请勿用于商业用途。  --天盟】
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: