List of usage examples for android.content.res ColorStateList valueOf
@NonNull public static ColorStateList valueOf(@ColorInt int color)
From source file:ro.expectations.expenses.ui.categories.EditCategoryActivity.java
@Override public void onColorSelected(@ColorInt int color, @ColorInt int darkColor, @ColorInt int accentColor) { // change the collapsing toolbar layout mCollapsingToolbarLayout.setBackgroundColor(color); // change the support action bar ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setBackgroundDrawable(new ColorDrawable(color)); }/* w w w. j a v a 2 s .co m*/ // change the status bar if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setStatusBarColor(darkColor); } // change the floating action button mFloatingActionButton.setBackgroundTintList(ColorStateList.valueOf(accentColor)); // change the change icon color GradientDrawable bgShape = (GradientDrawable) mChangeColorBackground.getBackground(); bgShape.setColor(0xFF000000 | accentColor); }
From source file:com.flexible.flexibleadapter.utils.DrawableUtils.java
/** * Adds a ripple effect to any background. * * @param drawable any background drawable * @param rippleColor the color of the ripple * @return the RippleDrawable with the chosen background drawable if at least Lollipop, * the provided drawable otherwise//from w w w . ja v a 2s .com * @since 5.0.0-rc1 */ public static Drawable getRippleDrawable(Drawable drawable, @ColorInt int rippleColor) { if (Utils.hasLollipop()) { return new RippleDrawable(ColorStateList.valueOf(rippleColor), drawable, getRippleMask(Color.BLACK)); } else { return drawable; } }
From source file:ticwear.design.widget.FloatingActionButton.java
public FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mProgressPadding = new Rect(); mTouchArea = new Rect(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.FloatingActionButton, defStyleAttr, defStyleRes);/*from w ww. j a v a 2 s. c o m*/ int rippleColor = a.getColor(R.styleable.FloatingActionButton_tic_rippleColor, 0); mSize = a.getInt(R.styleable.FloatingActionButton_tic_fabSize, SIZE_NORMAL); final float pressedTranslationZ = a.getDimension(R.styleable.FloatingActionButton_tic_pressedTranslationZ, 0f); int resId = a.getResourceId(R.styleable.FloatingActionButton_tic_circularDrawableStyle, 0); int translationX = a.getDimensionPixelOffset(R.styleable.FloatingActionButton_tic_minimizeTranslationX, 0); int translationY = a.getDimensionPixelOffset(R.styleable.FloatingActionButton_tic_minimizeTranslationY, 0); a.recycle(); Drawable shapeDrawable = createShapeDrawable(); Drawable rippleDrawable = new RippleDrawable(ColorStateList.valueOf(rippleColor), shapeDrawable, null); CircularProgressDrawable progressDrawable = createProgressDrawable(context, resId); Drawable backgroundDrawable = new CircularProgressContainerDrawable(new Drawable[] { rippleDrawable }, progressDrawable); super.setBackgroundDrawable(backgroundDrawable); int strokeSize = progressDrawable.getStrokeSize(); mProgressPadding.left = strokeSize; mProgressPadding.right = strokeSize; mProgressPadding.top = strokeSize; mProgressPadding.bottom = strokeSize; final int maxImageSize = (int) getResources().getDimension(R.dimen.tic_design_fab_image_size); mImagePadding = (getSizeDimension() + mProgressPadding.left + mProgressPadding.right - maxImageSize) / 2; setPadding(mImagePadding, mImagePadding, mImagePadding, mImagePadding); mAnimator = new FloatingActionButtonAnimator(this); mAnimator.setPressedTranslationZ(pressedTranslationZ); setMinimizeTranslation(translationX, translationY); mShowProgress = false; }
From source file:com.afwsamples.testdpc.SetupManagementFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null) { mLogoUri = (Uri) savedInstanceState.getParcelable(EXTRA_PROVISIONING_LOGO_URI); mCurrentColor = savedInstanceState.getInt(EXTRA_PROVISIONING_MAIN_COLOR); } else {// ww w. ja v a 2s. c o m mLogoUri = resourceToUri(getActivity(), R.drawable.ic_launcher); mCurrentColor = getResources().getColor(R.color.teal); } // Use setupwizard theme final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.SetupTheme); LayoutInflater themeInflater = inflater.cloneInContext(contextThemeWrapper); View view = themeInflater.inflate(R.layout.setup_management_fragment, container, false); SetupWizardLayout layout = (SetupWizardLayout) view.findViewById(R.id.setup_wizard_layout); NavigationBar navigationBar = layout.getNavigationBar(); navigationBar.setNavigationBarListener(this); navigationBar.getBackButton().setText(R.string.exit); mNavigationNextButton = navigationBar.getNextButton(); mNavigationNextButton.setText(R.string.setup_label); mSetupManagementMessage = (TextView) view.findViewById(R.id.setup_management_message_id); mSetupOptions = (RadioGroup) view.findViewById(R.id.setup_options); mSetupOptions.setOnCheckedChangeListener(this); mSkipUserConsent = (CheckBox) view.findViewById(R.id.skip_user_consent); mKeepAccountMigrated = (CheckBox) view.findViewById(R.id.keep_account_migrated); mSkipEncryption = (CheckBox) view.findViewById(R.id.skip_encryption); mParamsView = view.findViewById(R.id.params); mParamsIndicator = (ImageButton) view.findViewById(R.id.params_indicator); mParamsIndicator.setOnClickListener(this); view.findViewById(R.id.color_select_button).setOnClickListener(this); mColorValue = (TextView) view.findViewById(R.id.selected_color_value); mColorValue.setText(String.format(ColorPicker.COLOR_STRING_FORMATTER, mCurrentColor)); mColorPreviewView = (ImageView) view.findViewById(R.id.preview_color); mColorPreviewView.setImageTintList(ColorStateList.valueOf(mCurrentColor)); Intent launchIntent = getActivity().getIntent(); if (LaunchIntentUtil.isSynchronousAuthLaunch(launchIntent)) { Account addedAccount = LaunchIntentUtil.getAddedAccount(launchIntent); if (addedAccount != null) { view.findViewById(R.id.managed_account_desc).setVisibility(View.VISIBLE); // Show the user which account needs management. TextView managedAccountName = (TextView) view.findViewById(R.id.managed_account_name); managedAccountName.setVisibility(View.VISIBLE); managedAccountName.setText(addedAccount.name); } else { // This is not an expected case, sync-auth is triggered by an account being added so // we expect to be told which account to migrate in the launch intent. We don't // finish() here as it's still technically feasible to continue. Toast.makeText(getActivity(), R.string.invalid_launch_intent_no_account, Toast.LENGTH_LONG).show(); } } return view; }
From source file:j2w.team.common.view.tabstrip.SmartTabLayout.java
public SmartTabLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Disable the Scroll Bar setHorizontalScrollBarEnabled(false); final DisplayMetrics dm = getResources().getDisplayMetrics(); final float density = dm.density; int tabBackgroundResId = NO_ID; boolean textAllCaps = TAB_VIEW_TEXT_ALL_CAPS; ColorStateList textColors;/*from ww w. jav a 2 s . c om*/ float textSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP, dm); int textHorizontalPadding = (int) (TAB_VIEW_PADDING_DIPS * density); int textMinWidth = (int) (TAB_VIEW_TEXT_MIN_WIDTH * density); boolean distributeEvenly = DEFAULT_DISTRIBUTE_EVENLY; int customTabLayoutId = NO_ID; int customTabTextViewId = NO_ID; boolean clickable = TAB_CLICKABLE; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.stl_SmartTabLayout, defStyle, 0); tabBackgroundResId = a.getResourceId(R.styleable.stl_SmartTabLayout_stl_defaultTabBackground, tabBackgroundResId); textAllCaps = a.getBoolean(R.styleable.stl_SmartTabLayout_stl_defaultTabTextAllCaps, textAllCaps); textColors = a.getColorStateList(R.styleable.stl_SmartTabLayout_stl_defaultTabTextColor); textSize = a.getDimension(R.styleable.stl_SmartTabLayout_stl_defaultTabTextSize, textSize); textHorizontalPadding = a.getDimensionPixelSize( R.styleable.stl_SmartTabLayout_stl_defaultTabTextHorizontalPadding, textHorizontalPadding); textMinWidth = a.getDimensionPixelSize(R.styleable.stl_SmartTabLayout_stl_defaultTabTextMinWidth, textMinWidth); customTabLayoutId = a.getResourceId(R.styleable.stl_SmartTabLayout_stl_customTabTextLayoutId, customTabLayoutId); customTabTextViewId = a.getResourceId(R.styleable.stl_SmartTabLayout_stl_customTabTextViewId, customTabTextViewId); distributeEvenly = a.getBoolean(R.styleable.stl_SmartTabLayout_stl_distributeEvenly, distributeEvenly); clickable = a.getBoolean(R.styleable.stl_SmartTabLayout_stl_clickable, clickable); a.recycle(); this.titleOffset = (int) (TITLE_OFFSET_DIPS * density); this.tabViewBackgroundResId = tabBackgroundResId; this.tabViewTextAllCaps = textAllCaps; this.tabViewTextColors = (textColors != null) ? textColors : ColorStateList.valueOf(TAB_VIEW_TEXT_COLOR); this.tabViewTextSize = textSize; this.tabViewTextHorizontalPadding = textHorizontalPadding; this.tabViewTextMinWidth = textMinWidth; this.internalTabClickListener = clickable ? new InternalTabClickListener() : null; this.distributeEvenly = distributeEvenly; if (customTabLayoutId != NO_ID) { setCustomTabView(customTabLayoutId, customTabTextViewId); } this.tabStrip = new SmartTabStrip(context, attrs); if (distributeEvenly && tabStrip.isIndicatorAlwaysInCenter()) { throw new UnsupportedOperationException( "'distributeEvenly' and 'indicatorAlwaysInCenter' both use does not support"); } // Make sure that the Tab Strips fills this View setFillViewport(!tabStrip.isIndicatorAlwaysInCenter()); addView(tabStrip, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); }
From source file:com.ekuater.labelchat.ui.widget.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);/*from w w w.ja va 2 s .com*/ setWillNotDraw(false); tabsContainer = new LinearLayout(context); tabsContainer.setOrientation(LinearLayout.HORIZONTAL); tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); addView(tabsContainer); DisplayMetrics dm = getResources().getDisplayMetrics(); scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm); indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm); underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm); dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm); tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm); dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm); tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm); // get custom attrs TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); indicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, indicatorColor); underlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, underlineColor); dividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, dividerColor); indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, indicatorHeight); underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, underlineHeight); dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, dividerPadding); tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, tabPadding); tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, tabBackgroundResId); shouldExpand = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, shouldExpand); scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, scrollOffset); textAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTextAllCaps, textAllCaps); tabTextSize = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabTextSize, tabTextSize); tabTextColor = a.getColorStateList(R.styleable.PagerSlidingTabStrip_pstsTabTextColor); tabTypefaceStyle = indexToTextStyle(a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextStyle, -1), tabTypefaceStyle); tabSelectedTypefaceStyle = indexToTextStyle( a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabSelectedTextStyle, -1), tabSelectedTypefaceStyle); if (tabTextColor == null) { tabTextColor = ColorStateList.valueOf(0xFF666666); } a.recycle(); rectPaint = new Paint(); rectPaint.setAntiAlias(true); rectPaint.setStyle(Style.FILL); dividerPaint = new Paint(); dividerPaint.setAntiAlias(true); dividerPaint.setStrokeWidth(dividerWidth); defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1.0f); expandedTabLayoutParams.gravity = Gravity.CENTER; if (locale == null) { locale = getResources().getConfiguration().locale; } }
From source file:net.qiujuer.genius.widget.GeniusAbsSeekBar.java
public GeniusAbsSeekBar(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFocusable(true);/*from w w w. j a v a2 s . c o m*/ setWillNotDraw(false); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); // New final Resources resources = getResources(); final ColorStateList transparent = ColorStateList.valueOf(Color.TRANSPARENT); mAttributes = new SeekBarAttributes(this, resources); mRipple = new AlmostRippleDrawable(transparent); mRipple.setCallback(this); mSeekBarDrawable = new SeekBarDrawable(transparent, transparent, transparent); mSeekBarDrawable.setCallback(this); if (!isInEditMode()) { mIndicator = new GeniusPopupIndicator(context); mIndicator.setListener(mFloaterListener); } // Set Size setTrackStroke(resources.getDimensionPixelSize(R.dimen.genius_seekBar_trackStroke)); setScrubberStroke(resources.getDimensionPixelSize(R.dimen.genius_seekBar_scrubberStroke)); setThumbRadius(resources.getDimensionPixelSize(R.dimen.genius_seekBar_thumbSize)); setTouchRadius(resources.getDimensionPixelSize(R.dimen.genius_seekBar_touchSize)); setTickRadius(resources.getDimensionPixelSize(R.dimen.genius_seekBar_tickSize)); // Init init(attrs, defStyle); // End setNumericTransformer(new DefaultNumericTransformer()); isRtl(); if (attrs != null) setEnabled(attrs.getAttributeBooleanValue(GeniusUI.androidStyleNameSpace, "enabled", isEnabled())); else setEnabled(isEnabled()); }
From source file:net.qiujuer.genius.ui.widget.GeniusAbsSeekBar.java
public GeniusAbsSeekBar(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFocusable(true);/*from w ww . j av a 2 s . c o m*/ setWillNotDraw(false); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); // New final Resources resources = getResources(); final ColorStateList transparent = ColorStateList.valueOf(Color.TRANSPARENT); mAttributes = new SeekBarAttributes(this, resources); mRipple = new AlmostRippleDrawable(transparent); mRipple.setCallback(this); mSeekBarDrawable = new SeekBarDrawable(transparent, transparent, transparent); mSeekBarDrawable.setCallback(this); if (!isInEditMode()) { mIndicator = new GeniusPopupIndicator(context); mIndicator.setListener(mFloaterListener); } // Set Size setTrackStroke(resources.getDimensionPixelSize(R.dimen.genius_seekBar_trackStroke)); setScrubberStroke(resources.getDimensionPixelSize(R.dimen.genius_seekBar_scrubberStroke)); setThumbRadius(resources.getDimensionPixelSize(R.dimen.genius_seekBar_thumbSize)); setTouchRadius(resources.getDimensionPixelSize(R.dimen.genius_seekBar_touchSize)); setTickRadius(resources.getDimensionPixelSize(R.dimen.genius_seekBar_tickSize)); // Init init(attrs, defStyle); // End setNumericTransformer(new DefaultNumericTransformer()); isRtl(); if (attrs != null) setEnabled(attrs.getAttributeBooleanValue(GeniusUi.androidStyleNameSpace, "enabled", isEnabled())); else setEnabled(isEnabled()); }
From source file:com.socialinfotech.tabbar.smart.SmartTabLayout.java
public SmartTabLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Disable the Scroll Bar setHorizontalScrollBarEnabled(false); // Make sure that the Tab Strips fills this View setFillViewport(true);/*w w w. j a va 2 s. co m*/ final DisplayMetrics dm = getResources().getDisplayMetrics(); final float density = dm.density; boolean textAllCaps = TAB_VIEW_TEXT_ALL_CAPS; ColorStateList textColors; float textSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP, dm); int textHorizontalPadding = (int) (TAB_VIEW_PADDING_DIPS * density); int textMinWidth = (int) (TAB_VIEW_TEXT_MIN_WIDTH * density); boolean distributeEvenly = DEFAULT_DISTRIBUTE_EVENLY; int customTabLayoutId = NO_ID; int customTabTextViewId = NO_ID; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.stl_SmartTabLayout, defStyle, 0); textAllCaps = a.getBoolean(R.styleable.stl_SmartTabLayout_stl_defaultTabTextAllCaps, textAllCaps); textColors = a.getColorStateList(R.styleable.stl_SmartTabLayout_stl_defaultTabTextColor); textSize = a.getDimension(R.styleable.stl_SmartTabLayout_stl_defaultTabTextSize, textSize); textHorizontalPadding = a.getDimensionPixelSize( R.styleable.stl_SmartTabLayout_stl_defaultTabTextHorizontalPadding, textHorizontalPadding); textMinWidth = a.getDimensionPixelSize(R.styleable.stl_SmartTabLayout_stl_defaultTabTextMinWidth, textMinWidth); customTabLayoutId = a.getResourceId(R.styleable.stl_SmartTabLayout_stl_customTabTextLayoutId, customTabLayoutId); customTabTextViewId = a.getResourceId(R.styleable.stl_SmartTabLayout_stl_customTabTextViewId, customTabTextViewId); distributeEvenly = a.getBoolean(R.styleable.stl_SmartTabLayout_stl_distributeEvenly, distributeEvenly); a.recycle(); mTitleOffset = (int) (TITLE_OFFSET_DIPS * density); mTabViewTextAllCaps = textAllCaps; mTabViewTextColors = (textColors != null) ? textColors : ColorStateList.valueOf(TAB_VIEW_TEXT_COLOR); mTabViewTextSize = textSize; mTabViewTextHorizontalPadding = textHorizontalPadding; mTabViewTextMinWidth = textMinWidth; mDistributeEvenly = distributeEvenly; if (customTabLayoutId != NO_ID) { setCustomTabView(customTabLayoutId, customTabTextViewId); } mTabStrip = new SmartTabStrip(context, attrs); if (distributeEvenly && mTabStrip.isIndicatorAlwaysInCenter()) { throw new UnsupportedOperationException( "'distributeEvenly' and 'indicatorAlwaysInCenter' both use does not support"); } addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); }
From source file:com.it520.activity.main.wight.SmartTabLayout.java
public SmartTabLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Disable the Scroll Bar setHorizontalScrollBarEnabled(false); final DisplayMetrics dm = getResources().getDisplayMetrics(); final float density = dm.density; int tabBackgroundResId = NO_ID; boolean textAllCaps = TAB_VIEW_TEXT_ALL_CAPS; ColorStateList textColors;/*from ww w. j a v a 2 s. c o m*/ float textSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP, dm); int textHorizontalPadding = (int) (TAB_VIEW_PADDING_DIPS * density); int textMinWidth = (int) (TAB_VIEW_TEXT_MIN_WIDTH * density); boolean distributeEvenly = DEFAULT_DISTRIBUTE_EVENLY; int customTabLayoutId = NO_ID; int customTabTextViewId = NO_ID; boolean clickable = TAB_CLICKABLE; int titleOffset = (int) (TITLE_OFFSET_DIPS * density); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.stl_SmartTabLayout, defStyle, 0); tabBackgroundResId = a.getResourceId(R.styleable.stl_SmartTabLayout_stl_defaultTabBackground, tabBackgroundResId); textAllCaps = a.getBoolean(R.styleable.stl_SmartTabLayout_stl_defaultTabTextAllCaps, textAllCaps); textColors = a.getColorStateList(R.styleable.stl_SmartTabLayout_stl_defaultTabTextColor); textSize = a.getDimension(R.styleable.stl_SmartTabLayout_stl_defaultTabTextSize, textSize); textHorizontalPadding = a.getDimensionPixelSize( R.styleable.stl_SmartTabLayout_stl_defaultTabTextHorizontalPadding, textHorizontalPadding); textMinWidth = a.getDimensionPixelSize(R.styleable.stl_SmartTabLayout_stl_defaultTabTextMinWidth, textMinWidth); customTabLayoutId = a.getResourceId(R.styleable.stl_SmartTabLayout_stl_customTabTextLayoutId, customTabLayoutId); customTabTextViewId = a.getResourceId(R.styleable.stl_SmartTabLayout_stl_customTabTextViewId, customTabTextViewId); distributeEvenly = a.getBoolean(R.styleable.stl_SmartTabLayout_stl_distributeEvenly, distributeEvenly); clickable = a.getBoolean(R.styleable.stl_SmartTabLayout_stl_clickable, clickable); titleOffset = a.getLayoutDimension(R.styleable.stl_SmartTabLayout_stl_titleOffset, titleOffset); a.recycle(); this.titleOffset = titleOffset; this.tabViewBackgroundResId = tabBackgroundResId; this.tabViewTextAllCaps = textAllCaps; this.tabViewTextColors = (textColors != null) ? textColors : ColorStateList.valueOf(TAB_VIEW_TEXT_COLOR); this.tabViewTextSize = textSize; this.tabViewTextHorizontalPadding = textHorizontalPadding; this.tabViewTextMinWidth = textMinWidth; this.internalTabClickListener = clickable ? new InternalTabClickListener() : null; this.distributeEvenly = distributeEvenly; if (customTabLayoutId != NO_ID) { setCustomTabView(customTabLayoutId, customTabTextViewId); } this.tabStrip = new SmartTabStrip(context, attrs); if (distributeEvenly && tabStrip.isIndicatorAlwaysInCenter()) { throw new UnsupportedOperationException( "'distributeEvenly' and 'indicatorAlwaysInCenter' both use does not support"); } // Make sure that the Tab Strips fills this View setFillViewport(!tabStrip.isIndicatorAlwaysInCenter()); addView(tabStrip, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); }