Skip to content

Commit 06ecd30

Browse files
committed
代码设置样式
1 parent fa13a39 commit 06ecd30

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

library/src/main/java/com/study/xuan/library/widget/EasyTextView.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,30 @@ public void setIcon(String iconText) {
486486
build();
487487
}
488488

489+
/**
490+
* 设置左文案样式
491+
*/
492+
public void setTextLeftStyle(int textLeftStyle) {
493+
this.mTextLeftStyle = textLeftStyle;
494+
build();
495+
}
496+
497+
/**
498+
* 设置右文案样式
499+
*/
500+
public void setTextRightStyle(int textRightStyle) {
501+
this.mTextRightStyle = textRightStyle;
502+
build();
503+
}
504+
505+
/**
506+
* 设置中间文案样式
507+
*/
508+
public void setTextCenterStyle(int textCenterStyle) {
509+
this.mTextCenterStyle = textCenterStyle;
510+
build();
511+
}
512+
489513

490514
/**
491515
* span之前需要首先clear
@@ -629,6 +653,30 @@ public EasyTextView icon(String iconText) {
629653
return this;
630654
}
631655

656+
/**
657+
* 设置左文案样式
658+
*/
659+
public EasyTextView textLeftStyle(int textLeftStyle) {
660+
this.mTextLeftStyle = textLeftStyle;
661+
return this;
662+
}
663+
664+
/**
665+
* 设置右文案样式
666+
*/
667+
public EasyTextView textRightStyle(int textRightStyle) {
668+
this.mTextRightStyle = textRightStyle;
669+
return this;
670+
}
671+
672+
/**
673+
* 设置中间文案样式
674+
*/
675+
public EasyTextView textCenterStyle(int textCenterStyle) {
676+
this.mTextCenterStyle = textCenterStyle;
677+
return this;
678+
}
679+
632680
/**
633681
* 设置右边文字为多个span
634682
*/

library/src/main/res/values/attrs.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,14 @@
1919
<attr name="textLeft" format="reference|string"/>
2020
<attr name="textRight" format="reference|string"/>
2121
<attr name="textLeftStyle">
22-
<enum name="normal" value="0" />
2322
<enum name="bold" value="1" />
2423
<enum name="italic" value="2" />
2524
</attr>
2625
<attr name="textRightStyle">
27-
<enum name="normal" value="0" />
2826
<enum name="bold" value="1" />
2927
<enum name="italic" value="2" />
3028
</attr>
3129
<attr name="textCenterStyle">
32-
<enum name="normal" value="0" />
3330
<enum name="bold" value="1" />
3431
<enum name="italic" value="2" />
3532
</attr>

0 commit comments

Comments
 (0)