mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
@@ -131,19 +131,19 @@ public class TabLayout extends HorizontalScrollView {
|
||||
return this.mSelectedIndicatorColors;
|
||||
}
|
||||
|
||||
public void setTabTextColor(Integer color){
|
||||
public void setTabTextColor(int color){
|
||||
mTabStrip.setTabTextColor(color);
|
||||
}
|
||||
|
||||
public Integer getTabTextColor(){
|
||||
public int getTabTextColor(){
|
||||
return mTabStrip.getTabTextColor();
|
||||
}
|
||||
|
||||
public void setSelectedTabTextColor(Integer color){
|
||||
public void setSelectedTabTextColor(int color){
|
||||
mTabStrip.setSelectedTabTextColor(color);
|
||||
}
|
||||
|
||||
public Integer getSelectedTabTextColor(){
|
||||
public int getSelectedTabTextColor(){
|
||||
return mTabStrip.getSelectedTabTextColor();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,9 +50,8 @@ class TabStrip extends LinearLayout {
|
||||
private TabLayout.TabColorizer mCustomTabColorizer;
|
||||
private final SimpleTabColorizer mDefaultTabColorizer;
|
||||
|
||||
private int mDefaultTabTextColor;
|
||||
private int mTabTextColor = -1;
|
||||
private int mSelectedTabTextColor = -1;
|
||||
private int mTabTextColor;
|
||||
private int mSelectedTabTextColor;
|
||||
|
||||
TabStrip(Context context) {
|
||||
this(context, null);
|
||||
@@ -83,7 +82,10 @@ class TabStrip extends LinearLayout {
|
||||
mSelectedIndicatorPaint = new Paint();
|
||||
|
||||
TextView defaultTextView = new TextView(context);
|
||||
mDefaultTabTextColor = defaultTextView.getTextColors().getDefaultColor();
|
||||
mTabTextColor = defaultTextView.getTextColors().getDefaultColor();
|
||||
|
||||
// Default selected color is the same as mTabTextColor
|
||||
mSelectedTabTextColor = mTabTextColor;
|
||||
}
|
||||
|
||||
void setCustomTabColorizer(TabLayout.TabColorizer customTabColorizer) {
|
||||
@@ -122,20 +124,10 @@ class TabStrip extends LinearLayout {
|
||||
LinearLayout linearLayout = (LinearLayout)getChildAt(i);
|
||||
TextView textView = (TextView)linearLayout.getChildAt(1);
|
||||
if (i == mSelectedPosition){
|
||||
if (mSelectedTabTextColor >= 0){
|
||||
textView.setTextColor(mSelectedTabTextColor);
|
||||
}
|
||||
else {
|
||||
textView.setTextColor(mDefaultTabTextColor);
|
||||
}
|
||||
textView.setTextColor(mSelectedTabTextColor);
|
||||
}
|
||||
else {
|
||||
if (mTabTextColor >= 0){
|
||||
textView.setTextColor(mTabTextColor);
|
||||
}
|
||||
else {
|
||||
textView.setTextColor(mDefaultTabTextColor);
|
||||
}
|
||||
textView.setTextColor(mTabTextColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user