mirror of
https://github.com/Tencent/QMUI_Android.git
synced 2026-10-17 04:31:16 +08:00
feat: add tab description.
This commit is contained in:
@@ -76,6 +76,7 @@ public class QMUITab {
|
||||
@IconPosition int iconPosition = ICON_POSITION_TOP;
|
||||
int gravity = Gravity.CENTER;
|
||||
private CharSequence text;
|
||||
private CharSequence description;
|
||||
int signCountDigits = 2;
|
||||
int signCountHorizontalOffset = 0;
|
||||
int signCountVerticalOffset = 0;
|
||||
@@ -89,7 +90,12 @@ public class QMUITab {
|
||||
|
||||
|
||||
QMUITab(CharSequence text) {
|
||||
this(text, text);
|
||||
}
|
||||
|
||||
QMUITab(CharSequence text, CharSequence description) {
|
||||
this.text = text;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,6 +107,14 @@ public class QMUITab {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public void setDescription(CharSequence description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public CharSequence getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public int getIconPosition() {
|
||||
return iconPosition;
|
||||
}
|
||||
|
||||
@@ -90,10 +90,9 @@ public class QMUITabBuilder {
|
||||
* gravity of text
|
||||
*/
|
||||
private int gravity = Gravity.CENTER;
|
||||
/**
|
||||
* text
|
||||
*/
|
||||
|
||||
private CharSequence text;
|
||||
private CharSequence description;
|
||||
|
||||
/**
|
||||
* text typeface in normal state
|
||||
@@ -172,6 +171,7 @@ public class QMUITabBuilder {
|
||||
this.iconPosition = other.iconPosition;
|
||||
this.gravity = other.gravity;
|
||||
this.text = other.text;
|
||||
this.description = other.description;
|
||||
this.signCount = other.signCount;
|
||||
this.signCountDigits = other.signCountDigits;
|
||||
this.signCountHorizontalOffset = other.signCountHorizontalOffset;
|
||||
@@ -347,8 +347,13 @@ public class QMUITabBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public QMUITabBuilder setDescription(CharSequence description){
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public QMUITab build(Context context) {
|
||||
QMUITab tab = new QMUITab(this.text);
|
||||
QMUITab tab = new QMUITab(text, description == null ? text : description);
|
||||
if(!skinChangeWithTintColor){
|
||||
if(!skinChangeNormalWithTintColor){
|
||||
if(normalDrawableAttr != 0){
|
||||
|
||||
@@ -179,6 +179,7 @@ public class QMUITabView extends FrameLayout implements IQMUISkinHandlerView {
|
||||
}
|
||||
updateSkinInfo(tab);
|
||||
requestLayout();
|
||||
setContentDescription(tab.getDescription());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user