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