Spannable 實現TextView各類圖文結合效果,本例子主要由自定義SimplifySpanBuild實現,android特效
其中SimplifySpanBuild提供了appendSpecialUnitToFirst(),appendSpecialUnitToFirst()修改顏色。
使用主要以下:
SimplifySpanBuild simplifySpanBuild1 = new SimplifySpanBuild(this, tvText1, " 艾客優品雷霆Dock 2 雷電轉USB3.0/火線/esata 擴展HUB");
simplifySpanBuild1.appendSpecialUnitToFirst(new SpecialLabelUnit("1212", Color.WHITE, 8, Color.RED, 70, 35).useTextBold().setGravity(SpecialGravityEnum.CENTER))
.appendSpecialUnitToFirst(new SpecialLabelUnit("天貓", Color.WHITE, 8, 0xFFFF5000, 60, 35).setGravity(SpecialGravityEnum.CENTER));
tvText1.setText(simplifySpanBuild1.build());html
源碼地址:http://www.itlanbao.com/code/100701.htmlandroid