自己定義控件-MultipleTextView(自己主動換行、自己主動補齊寬度的排列多個TextView)
阿新 • • 發佈:2017-06-09
target con height wid andro -h 靈活 spa test
能夠設置每一個TextView 的字號、顏色、背景、Padding 和 字塊之間的margin 、行間距。
一、功能:
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
【 聲明:版權全部。歡迎轉載,請勿用於商業用途。
--天盟】
自己定義控件-MultipleTextView(自己主動換行、自己主動補齊寬度的排列多個TextView)