| | |
| | | private int textColor; |
| | | private int highLightTextColor; |
| | | |
| | | private int textSpecialColorPosition = -1; |
| | | private int textSpecialColor; |
| | | |
| | | private OnTabReselectedListener mTabReselectedListener; |
| | | |
| | | public MainTabPageIndicator(Context context) { |
| | |
| | | public void setTextColor(int textColor, int highLightTextColor) { |
| | | this.textColor = textColor; |
| | | this.highLightTextColor = highLightTextColor; |
| | | } |
| | | |
| | | public void setTextSpecialColor(int position, int color) { |
| | | this.textSpecialColorPosition = position; |
| | | this.textSpecialColor = color; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | for (int i = 0; i < mTabLayout.getChildCount(); i++) { |
| | | ((TextView) mTabLayout.getChildAt(i)).setTextSize(15); |
| | | ((TextView) mTabLayout.getChildAt(i)).setTextColor(textColor); |
| | | if (i == textSpecialColorPosition) { |
| | | ((TextView) mTabLayout.getChildAt(i)).setTextColor(textSpecialColor); |
| | | } else { |
| | | ((TextView) mTabLayout.getChildAt(i)).setTextColor(textColor); |
| | | } |
| | | ((TextView) mTabLayout.getChildAt(i)).setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); |
| | | } |
| | | ((TextView) tabView).setTextColor(highLightTextColor); |
| | |
| | | tabView.setOnClickListener(mTabClickListener); |
| | | tabView.setText(text); |
| | | if (textColor > 0) { |
| | | tabView.setTextColor(textColor); |
| | | if (index == textSpecialColorPosition) { |
| | | tabView.setTextColor(textSpecialColor); |
| | | } else |
| | | tabView.setTextColor(textColor); |
| | | } else { |
| | | tabView.setTextColor(R.color.black1); |
| | | } |