Example usage for android.content.res TypedArray getDimensionPixelSize

List of usage examples for android.content.res TypedArray getDimensionPixelSize

Introduction

In this page you can find the example usage for android.content.res TypedArray getDimensionPixelSize.

Prototype

public int getDimensionPixelSize(@StyleableRes int index, int defValue) 

Source Link

Document

Retrieve a dimensional unit attribute at index for use as a size in raw pixels.

Usage

From source file:android.support.v7ox.widget.SwitchCompat.java

/**
 * Sets the switch text color, size, style, hint color, and highlight color
 * from the specified TextAppearance resource.
 *//*from  w w w .  ja  v a 2 s.  co m*/
public void setSwitchTextAppearance(Context context, int resid) {
    TypedArray appearance = context.obtainStyledAttributes(resid, R.styleable.TextAppearance);

    ColorStateList colors;
    int ts;

    colors = appearance.getColorStateList(R.styleable.TextAppearance_android_textColor);
    if (colors != null) {
        mTextColors = colors;
    } else {
        // If no color set in TextAppearance, default to the view's textColor
        mTextColors = getTextColors();
    }

    ts = appearance.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, 0);
    if (ts != 0) {
        if (ts != mTextPaint.getTextSize()) {
            mTextPaint.setTextSize(ts);
            requestLayout();
        }
    }

    int typefaceIndex, styleIndex;
    typefaceIndex = appearance.getInt(R.styleable.TextAppearance_android_typeface, -1);
    styleIndex = appearance.getInt(R.styleable.TextAppearance_android_textStyle, -1);

    setSwitchTypefaceByIndex(typefaceIndex, styleIndex);

    boolean allCaps = appearance.getBoolean(R.styleable.TextAppearance_textAllCaps_ox, false);
    if (allCaps) {
        mSwitchTransformationMethod = new AllCapsTransformationMethod(getContext());
    } else {
        mSwitchTransformationMethod = null;
    }

    appearance.recycle();
}

From source file:com.android.hcframe.DraggableGridViewPager.java

public DraggableGridViewPager(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (attrs != null) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.dragGridView, defStyle, 0);
        mShowDivider = typedArray.getBoolean(R.styleable.dragGridView_dividerShowed, false);
        mDividerColor = typedArray.getColor(R.styleable.dragGridView_dividerColor, 0);
        mDividerPaddingTop = typedArray.getDimensionPixelSize(R.styleable.dragGridView_dividerPaddingTop, 0);
        mDividerPaddingBottom = typedArray.getDimensionPixelSize(R.styleable.dragGridView_dividerPaddingBottom,
                0);//  ww w .  j a v a2s.  c o m
        mDividerWidth = typedArray.getDimensionPixelSize(R.styleable.dragGridView_dividerWidth, 1);
        typedArray.recycle();
        HcLog.D(TAG + " divider color = " + mDividerColor);
    }
    initDraggableGridViewPager();
}

From source file:com.klinker.android.sliding.MultiShrinkScroller.java

/**
 * Create a new instance of MultiShrinkScroller.
 * @param context/*from w  w  w .  jav  a 2  s  . co  m*/
 * @param attrs
 * @param defStyleAttr
 */
public MultiShrinkScroller(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    setFocusable(false);
    setWillNotDraw(false);

    edgeGlowBottom = new EdgeEffect(context);
    edgeGlowTop = new EdgeEffect(context);
    scroller = new Scroller(context, INTERPOLATOR);
    touchSlop = configuration.getScaledTouchSlop();
    minimumVelocity = configuration.getScaledMinimumFlingVelocity();
    maximumVelocity = configuration.getScaledMaximumFlingVelocity();
    transparentStartHeight = (int) getResources().getDimension(R.dimen.sliding_starting_empty_height);
    toolbarElevation = getResources().getDimension(R.dimen.sliding_toolbar_elevation);
    isTwoPanel = getResources().getBoolean(R.bool.sliding_two_panel);
    maximumTitleMargin = (int) getResources().getDimension(R.dimen.sliding_title_initial_margin);

    dismissDistanceOnScroll = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_scroll);
    dismissDistanceOnRelease = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_release);
    snapToTopSlopHeight = (int) getResources().getDimension(R.dimen.sliding_snap_to_top_slop_height);

    final TypedValue photoRatio = new TypedValue();
    getResources().getValue(R.dimen.sliding_landscape_photo_ratio, photoRatio, true);
    landscapePhotoRatio = photoRatio.getFloat();

    final TypedArray attributeArray = context
            .obtainStyledAttributes(new int[] { android.R.attr.actionBarSize });
    actionBarSize = attributeArray.getDimensionPixelSize(0, 0);
    minimumHeaderHeight = actionBarSize;
    attributeArray.recycle();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        textSizePathInterpolator = new PathInterpolator(X1, Y1, X2, Y2);
    } else {
        textSizePathInterpolator = null;
    }
}

From source file:com.kkbox.toolkit.app.KKTabFragment.java

protected void initView(View view, int[] buttonTextResourcetId, boolean showSubFragmentAnimation,
        int currentIndex) {
    fixStateForNestedFragment();//from  ww  w  .  j av  a 2s  .  c  o m
    initView(view);
    if (this.currentIndex == -1) {
        this.currentIndex = currentIndex;
    }
    this.showSubFragmentAnimation = showSubFragmentAnimation;
    radioGroup = (RadioGroup) view.findViewById(R.id.button_radiogroup);

    TypedValue typedValue = new TypedValue();
    getActivity().getTheme().resolveAttribute(R.attr.KKTabFragmentStyle, typedValue, true);
    TypedArray array = getActivity().obtainStyledAttributes(typedValue.resourceId,
            new int[] { R.attr.KKTabButtonBackgroundLeft, R.attr.KKTabButtonBackgroundMiddle,
                    R.attr.KKTabButtonBackgroundRight });
    int tabButtonBackgroundLeftResourceId = array.getResourceId(0, -1);
    int tabButtonBackgroundMiddleResourceId = array.getResourceId(1, -1);
    int tabButtonBackgroundRightResourceId = array.getResourceId(2, -1);
    array.recycle();
    array = getActivity().obtainStyledAttributes(typedValue.resourceId, new int[] { R.attr.KKTabBackground });
    int backgroundResourceId = array.getResourceId(0, -1);
    FrameLayout layoutRadioBar = (FrameLayout) view.findViewById(R.id.layout_radio_bar);
    if (backgroundResourceId != -1) {
        layoutRadioBar.setBackgroundResource(backgroundResourceId);
    }
    array.recycle();

    array = getActivity().obtainStyledAttributes(typedValue.resourceId, new int[] { R.attr.KKTabOverlay });
    int overlayResourceId = array.getResourceId(0, -1);
    ImageView viewOverlay = (ImageView) view.findViewById(R.id.view_overlay);
    if (overlayResourceId != -1) {
        viewOverlay.setBackgroundResource(overlayResourceId);
    }
    array.recycle();

    array = getActivity().obtainStyledAttributes(typedValue.resourceId, new int[] { android.R.attr.textSize });
    int textSize = array.getDimensionPixelSize(0, -1);
    array.recycle();
    array = getActivity().obtainStyledAttributes(typedValue.resourceId, new int[] { android.R.attr.textColor });
    ColorStateList textColor = array.getColorStateList(0);
    array.recycle();
    array = getActivity().obtainStyledAttributes(typedValue.resourceId, new int[] { android.R.attr.height });
    int height = array.getDimensionPixelSize(0, -1);
    array.recycle();
    for (int i = 0; i < buttonTextResourcetId.length; i++) {
        RadioButton radioButton = new RadioButton(getActivity());
        if (i == 0 && tabButtonBackgroundLeftResourceId != -1) {
            radioButton.setBackgroundResource(tabButtonBackgroundLeftResourceId);
        } else if (i == buttonTextResourcetId.length - 1 && tabButtonBackgroundRightResourceId != -1) {
            radioButton.setBackgroundResource(tabButtonBackgroundRightResourceId);
        } else if (tabButtonBackgroundMiddleResourceId != -1) {
            radioButton.setBackgroundResource(tabButtonBackgroundMiddleResourceId);
        }
        radioButton.setText(buttonTextResourcetId[i]);
        radioButton.setButtonDrawable(new StateListDrawable());
        radioButton.setGravity(Gravity.CENTER);
        radioButton.setTextColor(textColor);
        radioButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
        radioButton.setLayoutParams(new RadioGroup.LayoutParams(0, height, 1));
        radioButton.setOnClickListener(buttonClickListener);
        radioGroup.addView(radioButton);
    }
    currentFragment = null;
    radioGroup.getChildAt(this.currentIndex).performClick();

}

From source file:com.abslyon.abetterselection.CoverFlow.CoverFlowView.java

private void initAttributes(Context context, AttributeSet attrs) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ImageCoverFlowView);

    int totalVisibleChildren = a.getInt(R.styleable.ImageCoverFlowView_visibleImage, 2);

    if (totalVisibleChildren % 2 == 0) {
        throw new IllegalArgumentException("visible image must be an odd number");
    }//from w  ww  .  j av a2 s.  c o m

    VISIBLE_VIEWS = totalVisibleChildren >> 1;

    reflectHeightFraction = a.getFraction(R.styleable.ImageCoverFlowView_reflectionHeight, 100, 0, 0.0f);
    if (reflectHeightFraction > 100) {
        reflectHeightFraction = 100;
    }
    reflectHeightFraction /= 100;
    reflectGap = a.getDimensionPixelSize(R.styleable.ImageCoverFlowView_reflectionGap, 0);

    mGravity = CoverFlowGravity.values()[a.getInt(R.styleable.ImageCoverFlowView_coverflowGravity,
            CoverFlowGravity.CENTER_VERTICAL.ordinal())];

    mLayoutMode = CoverFlowLayoutMode.values()[a.getInt(R.styleable.ImageCoverFlowView_coverflowLayoutMode,
            CoverFlowLayoutMode.WRAP_CONTENT.ordinal())];

    a.recycle();
}

From source file:com.mukesh.OtpView.java

public OtpView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    final Resources res = getResources();
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.STROKE);
    animatorTextPaint.set(getPaint());//from   w  ww.j  av a2s  . com
    final Resources.Theme theme = context.getTheme();
    TypedArray typedArray = theme.obtainStyledAttributes(attrs, R.styleable.OtpView, defStyleAttr, 0);
    viewType = typedArray.getInt(R.styleable.OtpView_viewType, VIEW_TYPE_RECTANGLE);
    otpViewItemCount = typedArray.getInt(R.styleable.OtpView_itemCount, DEFAULT_COUNT);
    otpViewItemHeight = (int) typedArray.getDimension(R.styleable.OtpView_itemHeight,
            res.getDimensionPixelSize(R.dimen.otp_view_item_size));
    otpViewItemWidth = (int) typedArray.getDimension(R.styleable.OtpView_itemWidth,
            res.getDimensionPixelSize(R.dimen.otp_view_item_size));
    otpViewItemSpacing = typedArray.getDimensionPixelSize(R.styleable.OtpView_itemSpacing,
            res.getDimensionPixelSize(R.dimen.otp_view_item_spacing));
    otpViewItemRadius = (int) typedArray.getDimension(R.styleable.OtpView_itemRadius, 0);
    lineWidth = (int) typedArray.getDimension(R.styleable.OtpView_lineWidth,
            res.getDimensionPixelSize(R.dimen.otp_view_item_line_width));
    lineColor = typedArray.getColorStateList(R.styleable.OtpView_lineColor);
    isCursorVisible = typedArray.getBoolean(R.styleable.OtpView_android_cursorVisible, true);
    cursorColor = typedArray.getColor(R.styleable.OtpView_cursorColor, getCurrentTextColor());
    cursorWidth = typedArray.getDimensionPixelSize(R.styleable.OtpView_cursorWidth,
            res.getDimensionPixelSize(R.dimen.otp_view_cursor_width));
    itemBackground = typedArray.getDrawable(R.styleable.OtpView_android_itemBackground);
    hideLineWhenFilled = typedArray.getBoolean(R.styleable.OtpView_hideLineWhenFilled, false);
    rtlTextDirection = typedArray.getBoolean(R.styleable.OtpView_rtlTextDirection, false);
    typedArray.recycle();
    if (lineColor != null) {
        cursorLineColor = lineColor.getDefaultColor();
    }
    updateCursorHeight();
    checkItemRadius();
    setMaxLength(otpViewItemCount);
    paint.setStrokeWidth(lineWidth);
    setupAnimator();
    super.setCursorVisible(false);
    setTextIsSelectable(false);
}

From source file:com.atobo.safecoo.view.coverflow.CoverFlowView.java

private void initAttributes(Context context, AttributeSet attrs) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ImageCoverFlowView);

    int totalVisibleChildren = a.getInt(R.styleable.ImageCoverFlowView_visibleImage, 2);
    if (totalVisibleChildren % 2 == 0) {
        throw new IllegalArgumentException("visible image must be an odd number");
    }/*from   ww  w.  ja va  2 s . co m*/

    VISIBLE_VIEWS = totalVisibleChildren >> 1;

    reflectHeightFraction = a.getFraction(R.styleable.ImageCoverFlowView_reflectionHeight, 100, 0, 0.0f);
    if (reflectHeightFraction > 100) {
        reflectHeightFraction = 100;
    }
    reflectHeightFraction /= 100;
    reflectGap = a.getDimensionPixelSize(R.styleable.ImageCoverFlowView_reflectionGap, 0);

    mGravity = CoverFlowGravity.values()[a.getInt(R.styleable.ImageCoverFlowView_coverflowGravity,
            CoverFlowGravity.CENTER_VERTICAL.ordinal())];

    mLayoutMode = CoverFlowLayoutMode.values()[a.getInt(R.styleable.ImageCoverFlowView_coverflowLayoutMode,
            CoverFlowLayoutMode.WRAP_CONTENT.ordinal())];

    a.recycle();
}

From source file:com.microhealthllc.Slide.MultiShrinkScroller.java

/**
 * Create a new instance of MultiShrinkScroller.
 *
 * @param context//  w  w w . j a v a  2  s.  com
 * @param attrs
 * @param defStyleAttr
 */
public MultiShrinkScroller(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    setFocusable(false);
    setWillNotDraw(false);

    edgeGlowBottom = new EdgeEffect(context);
    edgeGlowTop = new EdgeEffect(context);
    scroller = new Scroller(context, INTERPOLATOR);
    touchSlop = configuration.getScaledTouchSlop();
    minimumVelocity = configuration.getScaledMinimumFlingVelocity();
    maximumVelocity = configuration.getScaledMaximumFlingVelocity();
    transparentStartHeight = (int) getResources().getDimension(R.dimen.sliding_starting_empty_height);
    toolbarElevation = getResources().getDimension(R.dimen.sliding_toolbar_elevation);
    isTwoPanel = getResources().getBoolean(R.bool.sliding_two_panel);
    paddedLayout = getResources().getBoolean(R.bool.padded_layout);
    maximumTitleMargin = (int) getResources().getDimension(R.dimen.sliding_title_initial_margin);

    dismissDistanceOnScroll = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_scroll);
    dismissDistanceOnRelease = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_release);
    snapToTopSlopHeight = (int) getResources().getDimension(R.dimen.sliding_snap_to_top_slop_height);

    final TypedValue photoRatio = new TypedValue();
    getResources().getValue(R.dimen.sliding_landscape_photo_ratio, photoRatio, true);
    landscapePhotoRatio = photoRatio.getFloat();

    final TypedArray attributeArray = context
            .obtainStyledAttributes(new int[] { android.R.attr.actionBarSize });
    actionBarSize = attributeArray.getDimensionPixelSize(0, 0);
    minimumHeaderHeight = actionBarSize;
    attributeArray.recycle();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        textSizePathInterpolator = new PathInterpolator(X1, Y1, X2, Y2);
    } else {
        textSizePathInterpolator = null;
    }
}

From source file:co.ceryle.segmentedbutton.SegmentedButton.java

private void getAttributes(AttributeSet attrs) {
    TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.SegmentedButton);
    imageTint = typedArray.getColor(R.styleable.SegmentedButton_sb_imageTint, -1);
    hasButtonImageTint = typedArray.hasValue(R.styleable.SegmentedButton_sb_imageTint);
    buttonImageScale = typedArray.getFloat(R.styleable.SegmentedButton_sb_imageScale, 1);

    selectedImageTint = typedArray.getColor(R.styleable.SegmentedButton_sb_selectedImageTint, 0);
    hasSelectedImageTint = typedArray.hasValue(R.styleable.SegmentedButton_sb_selectedImageTint);

    selectedTextColor = typedArray.getColor(R.styleable.SegmentedButton_sb_selectedTextColor, 0);
    hasTextColorOnSelection = typedArray.hasValue(R.styleable.SegmentedButton_sb_selectedTextColor);

    rippleColor = typedArray.getColor(R.styleable.SegmentedButton_sb_rippleColor, 0);
    hasRipple = typedArray.hasValue(R.styleable.SegmentedButton_sb_rippleColor);

    typeface = typedArray.getString(R.styleable.SegmentedButton_sb_typeface);

    try {/*  w  ww .  jav a2 s . com*/
        hasWeight = typedArray.hasValue(R.styleable.SegmentedButton_android_layout_weight);
        buttonWeight = typedArray.getFloat(R.styleable.SegmentedButton_android_layout_weight, -1);

        buttonWidth = typedArray.getDimensionPixelSize(R.styleable.SegmentedButton_android_layout_width, 0);
        hasWidth = typedArray.hasValue(R.styleable.SegmentedButton_android_layout_width);

    } catch (Exception ex) {
        Log.d("SegmentedButton", ex.toString());
    }

    typedArray.recycle();
}

From source file:am.widget.indicatortabstrip.IndicatorTabStrip.java

public IndicatorTabStrip(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setItemClickable(true);//from ww  w  . ja va 2s.  com
    setClickSmoothScroll(true);
    final float density = getResources().getDisplayMetrics().density;
    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    mTextPaint.setTextAlign(Align.CENTER);
    if (Build.VERSION.SDK_INT > 4) {
        updateTextPaintDensity();
    }
    mTagLocation = new TagLocation(TagLocation.LOCATION_EDGE);
    final TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);
    int n = a.getIndexCount();
    int textSize = (int) (DEFAULT_TEXT_SIZE * density);
    ColorStateList textColors = null;
    Drawable divider = null;
    for (int i = 0; i < n; i++) {
        int attr = a.getIndex(i);
        switch (attr) {
        case 0:
            textSize = a.getDimensionPixelSize(attr, textSize);
            break;
        case 1:
            textColors = a.getColorStateList(attr);
            break;
        case 2:
            divider = a.getDrawable(attr);
            break;
        }
    }
    a.recycle();
    float scale = 1;
    Drawable itemBackground = null;
    ColorStateList gradient = null;
    Drawable indicator = null;
    int indicatorWidthMode = INDICATOR_WIDTH_MODE_SET;
    int indicatorPadding = 0;
    int indicatorWidth = INDICATOR_WIDTH_BY_DRAWABLE;
    int indicatorHeight = INDICATOR_HEIGHT_BY_DRAWABLE;
    Drawable interval = null;
    int minItemWidth = (int) (DEFAULT_ITEM_WIDTH * density);
    int minItemHeight = (int) (DEFAULT_ITEM_HEIGHT * density);
    int tagTextSize = (int) (DEFAULT_TAG_TEXT_SIZE * density);
    int tagTextColor = DEFAULT_TAG_TEXT_COLOR;
    Drawable tagBackground = getDefaultTagBackground();
    int tagMinSizeMode = TAG_MIN_SIZE_MODE_HAS_TEXT;
    int tagMinWidth = (int) (DEFAULT_TAG_MIN_SIZE * density);
    int tagMinHeight = (int) (DEFAULT_TAG_MIN_SIZE * density);
    int tagPaddingLeft = 0;
    int tagPaddingTop = 0;
    int tagPaddingRight = 0;
    int tagPaddingBottom = 0;
    int tagMarginLeft = 0;
    int tagMarginTop = 0;
    int tagMarginRight = 0;
    int tagMarginBottom = 0;
    TypedArray custom = context.obtainStyledAttributes(attrs, R.styleable.IndicatorTabStrip);
    textSize = custom.getDimensionPixelSize(R.styleable.IndicatorTabStrip_ttsTextSize, textSize);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsTextColor))
        textColors = custom.getColorStateList(R.styleable.IndicatorTabStrip_ttsTextColor);
    scale = custom.getFloat(R.styleable.IndicatorTabStrip_ttsTextScale, scale);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsBackground))
        itemBackground = custom.getDrawable(R.styleable.IndicatorTabStrip_ttsBackground);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsGradient))
        gradient = custom.getColorStateList(R.styleable.IndicatorTabStrip_ttsGradient);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsDivider))
        divider = custom.getDrawable(R.styleable.IndicatorTabStrip_ttsDivider);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsIndicator))
        indicator = custom.getDrawable(R.styleable.IndicatorTabStrip_ttsIndicator);
    indicatorWidthMode = custom.getInt(R.styleable.IndicatorTabStrip_ttsIndicatorWidthMode, indicatorWidthMode);
    indicatorPadding = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsIndicatorPadding,
            indicatorPadding);
    indicatorWidth = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsIndicatorWidth,
            indicatorWidth);
    indicatorHeight = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsIndicatorHeight,
            indicatorHeight);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsInterval))
        interval = custom.getDrawable(R.styleable.IndicatorTabStrip_ttsInterval);
    minItemWidth = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsMinItemWidth, minItemWidth);
    minItemHeight = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsMinItemHeight,
            minItemHeight);
    tagTextSize = custom.getDimensionPixelSize(R.styleable.IndicatorTabStrip_ttsTagTextSize, tagTextSize);
    tagTextColor = custom.getColor(R.styleable.IndicatorTabStrip_ttsTagTextColor, tagTextColor);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsTagBackground))
        tagBackground = custom.getDrawable(R.styleable.IndicatorTabStrip_ttsTagBackground);
    tagMinSizeMode = custom.getInt(R.styleable.IndicatorTabStrip_ttsTagMinSizeMode, tagMinSizeMode);
    tagMinWidth = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMinWidth, tagMinWidth);
    tagMinHeight = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMinHeight, tagMinHeight);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsTagPadding)) {
        final int padding = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagPadding, 0);
        tagPaddingLeft = padding;
        tagPaddingTop = padding;
        tagPaddingRight = padding;
        tagPaddingBottom = padding;
    }
    tagPaddingLeft = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagPaddingLeft,
            tagPaddingLeft);
    tagPaddingTop = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagPaddingTop,
            tagPaddingTop);
    tagPaddingRight = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagPaddingRight,
            tagPaddingRight);
    tagPaddingBottom = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagPaddingBottom,
            tagPaddingBottom);
    if (custom.hasValue(R.styleable.IndicatorTabStrip_ttsTagMargin)) {
        final int margin = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMargin, 0);
        tagMarginLeft = margin;
        tagMarginTop = margin;
        tagMarginRight = margin;
        tagMarginBottom = margin;
    }
    tagMarginLeft = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMarginLeft,
            tagMarginLeft);
    tagMarginTop = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMarginTop, tagMarginTop);
    tagMarginRight = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMarginRight,
            tagMarginRight);
    tagMarginBottom = custom.getDimensionPixelOffset(R.styleable.IndicatorTabStrip_ttsTagMarginBottom,
            tagMarginBottom);
    custom.recycle();
    setTextSize(textSize);
    if (textColors != null) {
        setTextColor(textColors);
    } else {
        setTextColor(DEFAULT_TEXT_COLOR);
    }
    setTextScale(scale);
    setItemBackground(itemBackground);
    setGradient(gradient);
    setDivider(divider);
    setIndicator(indicator);
    setIndicatorWidthMode(indicatorWidthMode);
    setIndicatorPadding(indicatorPadding);
    setIndicatorWidth(indicatorWidth);
    setIndicatorHeight(indicatorHeight);
    setInterval(interval);
    setMinItemWidth(minItemWidth);
    setMinItemHeight(minItemHeight);
    setTagTextSize(tagTextSize);
    setTagTextColor(tagTextColor);
    setTagBackground(tagBackground);
    setTagMinSizeMode(tagMinSizeMode);
    setTagMinWidth(tagMinWidth);
    setTagMinHeight(tagMinHeight);
    setTagPadding(tagPaddingLeft, tagPaddingTop, tagPaddingRight, tagPaddingBottom);
    setTagMargin(tagMarginLeft, tagMarginTop, tagMarginRight, tagMarginBottom);
}