当前位置: 首页>>代码示例>>Java>>正文


Java TypedArray.getBoolean方法代码示例

本文整理汇总了Java中android.content.res.TypedArray.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java TypedArray.getBoolean方法的具体用法?Java TypedArray.getBoolean怎么用?Java TypedArray.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.res.TypedArray的用法示例。


在下文中一共展示了TypedArray.getBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initStyleable

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void initStyleable(Context context, AttributeSet attrs) {
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.BaseRecyclerView);
    layoutMode = array.getInt(R.styleable.BaseRecyclerView_layoutMode, VERTICAL);
    spanCount = array.getInt(R.styleable.BaseRecyclerView_columnCount, 3);
    rowDivider = array.getBoolean(R.styleable.BaseRecyclerView_row_divider, false);
    spanDivider = array.getBoolean(R.styleable.BaseRecyclerView_span_divider, false);

    dividerWidth = (int) array.getDimension(R.styleable.BaseRecyclerView_divider_width, 1f);
    dividerHeight = (int) array.getDimension(R.styleable.BaseRecyclerView_divider_height, 1f);
    marginLeft = (int) array.getDimension(R.styleable.BaseRecyclerView_divider_marginLeft, 0f);
    marginRight = (int) array.getDimension(R.styleable.BaseRecyclerView_divider_marginRight, 0f);
    marginTop = (int) array.getDimension(R.styleable.BaseRecyclerView_divider_marginTop, 0f);
    marginBottom = (int) array.getDimension(R.styleable.BaseRecyclerView_divider_marginBottom, 0f);
    dividerColor = array.getColor(R.styleable.BaseRecyclerView_divider_color, Color.TRANSPARENT);
    array.recycle();
}
 
开发者ID:Jusenr,项目名称:AppFirCloud,代码行数:17,代码来源:BaseRecyclerView.java

示例2: LoadingRetryView

import android.content.res.TypedArray; //导入方法依赖的package包/类
public LoadingRetryView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    TypedArray a = context.getTheme().obtainStyledAttributes(
            attrs,
            R.styleable.LoadingRetryView,
            defStyleAttr, 0);

    try {
        if (a.hasValue(R.styleable.LoadingRetryView_loadingMessage)) {
            loadingMessage = a.getString(R.styleable.LoadingRetryView_loadingMessage);
        } else {
            loadingMessage = context.getString(R.string.default_loading_message);
        }
        if (a.hasValue(R.styleable.LoadingRetryView_retryMessage)) {
            retryMessage = a.getString(R.styleable.LoadingRetryView_retryMessage);
        } else {
            retryMessage = context.getString(R.string.default_loading_message);
        }
        showLoadingMessage = a.getBoolean(R.styleable.LoadingRetryView_showLoadingMessage, true);
        showRetryMessage = a.getBoolean(R.styleable.LoadingRetryView_showRetryMessage, true);
        state = a.getInteger(R.styleable.LoadingRetryView_state, 0);
    } finally {
        a.recycle();
    }
}
 
开发者ID:sztomek,项目名称:cleanarchitecture-unidirectional,代码行数:26,代码来源:LoadingRetryView.java

示例3: TabIndicator

import android.content.res.TypedArray; //导入方法依赖的package包/类
public TabIndicator(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.TabIndicator);
    mCount = ta.getInt(R.styleable.TabIndicator_visiabel_size,4);
    mTabWidth = ta.getDimensionPixelSize(R.styleable.TabIndicator_tab_width,30);
    mTabHeight = ta.getDimensionPixelSize(R.styleable.TabIndicator_tab_height,10);
    mTriColor = ta.getResourceId(R.styleable.TabIndicator_tab_color,R.color.page_white);
    mDefaultColor = ta.getColor(R.styleable.TabIndicator_tab_text_default_color,mDefaultColor);
    mChangeColor = ta.getColor(R.styleable.TabIndicator_tab_text_change_color,mChangeColor);
    mTextSize = ta.getDimensionPixelSize(R.styleable.TabIndicator_tab_textsize,
            getResources().getDimensionPixelSize(R.dimen.tabsize));
    mTabtyle = ta.getInteger(R.styleable.TabIndicator_tap_type,1);

    mTextType = ta.getInteger(R.styleable.TabIndicator_tab_text_type,1);
    isShowTab = ta.getBoolean(R.styleable.TabIndicator_tab_show,isShowTab);
    ta.recycle();
    initData();

}
 
开发者ID:LillteZheng,项目名称:ViewPagerHelper,代码行数:20,代码来源:TabIndicator.java

示例4: init

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs) {
    mMediumAnimTime = getContext().getResources().getInteger(android.R.integer.config_mediumAnimTime);

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ProgressImageView);
    try {
        this.mProgress = a.getInteger(R.styleable.ProgressImageView_pi_progress, 0);
        this.mStrokeWidth = a.getDimensionPixelOffset(R.styleable.ProgressImageView_pi_stroke, 8);
        this.mRadius = a.getDimensionPixelOffset(R.styleable.ProgressImageView_pi_radius, 0);
        this.mIsSquare = a.getBoolean(R.styleable.ProgressImageView_pi_force_square, false);
        this.mMaskColor = a.getColor(R.styleable.ProgressImageView_pi_mask_color, Color.argb(180, 0, 0, 0));

        this.mPaint = new Paint();
        mPaint.setColor(mMaskColor);
        mPaint.setAntiAlias(true);

        this.mShimmerPaint = new Paint();
        mShimmerPaint.setColor(Color.WHITE);
    } finally {
        a.recycle();
    }
    mShimmerViewHelper = new ShimmerViewHelper(this, mShimmerPaint, attrs);
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:23,代码来源:LauncherIconView.java

示例5: initWith

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void initWith(Context context, AttributeSet attrs) {
	final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ColorPickerPreference);

	try {
		alphaSlider = typedArray.getBoolean(R.styleable.ColorPickerPreference_alphaSlider, false);
		lightSlider = typedArray.getBoolean(R.styleable.ColorPickerPreference_lightnessSlider, false);

		density = typedArray.getInt(R.styleable.ColorPickerPreference_density, 10);
		wheelType = ColorPickerView.WHEEL_TYPE.indexOf(typedArray.getInt(R.styleable.ColorPickerPreference_wheelType, 0));

		selectedColor = typedArray.getInt(R.styleable.ColorPickerPreference_initialColor, 0xffffffff);

		pickerTitle = typedArray.getString(R.styleable.ColorPickerPreference_pickerTitle);
		if (pickerTitle==null)
			pickerTitle = "Choose color";

		pickerButtonCancel = typedArray.getString(R.styleable.ColorPickerPreference_pickerButtonCancel);
		if (pickerButtonCancel==null)
			pickerButtonCancel = "cancel";

		pickerButtonOk = typedArray.getString(R.styleable.ColorPickerPreference_pickerButtonOk);
		if (pickerButtonOk==null)
			pickerButtonOk = "ok";

	} finally {
		typedArray.recycle();
	}

	setWidgetLayoutResource(R.layout.color_widget);
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:31,代码来源:ColorPickerPreference.java

示例6: create

import android.content.res.TypedArray; //导入方法依赖的package包/类
/**
    * Creates a new instance of {@code AutofitHelper} that wraps a {@link TextView} and enables
    * automatically sizing the text to fit.
    */
   public static AutofitHelper create(AppCompatTextView view, AttributeSet attrs, int defStyle)
{
       AutofitHelper helper = new AutofitHelper(view);
       boolean sizeToFit = true;
       if (attrs != null)
	{
           Context context = view.getContext();
           int minTextSize = (int) helper.getMinTextSize();
           float precision = helper.getPrecision();

           TypedArray ta = context.obtainStyledAttributes(
			attrs,
			R.styleable.AutofitTextView,
			defStyle,
			0);
           sizeToFit = ta.getBoolean(R.styleable.AutofitTextView_sizeToFit, sizeToFit);
           minTextSize = ta.getDimensionPixelSize(R.styleable.AutofitTextView_minTextSize,
											   minTextSize);
           precision = ta.getFloat(R.styleable.AutofitTextView_precision, precision);
           ta.recycle();

           helper.setMinTextSize(TypedValue.COMPLEX_UNIT_PX, minTextSize)
               .setPrecision(precision);
       }
       helper.setEnabled(sizeToFit);

       return helper;
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:33,代码来源:AutofitHelper.java

示例7: LayoutParams

import android.content.res.TypedArray; //导入方法依赖的package包/类
public LayoutParams(Context c, AttributeSet attrs) {
    super(c, attrs);
    TypedArray a = c.obtainStyledAttributes(attrs,
            R.styleable.InsettableFrameLayout_Layout);
    ignoreInsets = a.getBoolean(
            R.styleable.InsettableFrameLayout_Layout_layout_ignoreInsets, false);
    a.recycle();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:9,代码来源:InsettableFrameLayout.java

示例8: obtainAttributes

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void obtainAttributes(Context context, AttributeSet attrs) {
    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SlidingTabLayout);

    mIndicatorStyle = ta.getInt(R.styleable.SlidingTabLayout_tl_indicator_style, STYLE_NORMAL);
    mIndicatorColor = ta.getColor(R.styleable.SlidingTabLayout_tl_indicator_color, Color.parseColor(mIndicatorStyle == STYLE_BLOCK ? "#4B6A87" : "#ffffff"));
    mIndicatorHeight = ta.getDimension(R.styleable.SlidingTabLayout_tl_indicator_height,
            dp2px(mIndicatorStyle == STYLE_TRIANGLE ? 4 : (mIndicatorStyle == STYLE_BLOCK ? -1 : 2)));
    mIndicatorWidth = ta.getDimension(R.styleable.SlidingTabLayout_tl_indicator_width, dp2px(mIndicatorStyle == STYLE_TRIANGLE ? 10 : -1));
    mIndicatorCornerRadius = ta.getDimension(R.styleable.SlidingTabLayout_tl_indicator_corner_radius, dp2px(mIndicatorStyle == STYLE_BLOCK ? -1 : 0));
    mIndicatorMarginLeft = ta.getDimension(R.styleable.SlidingTabLayout_tl_indicator_margin_left, dp2px(0));
    mIndicatorMarginTop = ta.getDimension(R.styleable.SlidingTabLayout_tl_indicator_margin_top, dp2px(mIndicatorStyle == STYLE_BLOCK ? 7 : 0));
    mIndicatorMarginRight = ta.getDimension(R.styleable.SlidingTabLayout_tl_indicator_margin_right, dp2px(0));
    mIndicatorMarginBottom = ta.getDimension(R.styleable.SlidingTabLayout_tl_indicator_margin_bottom, dp2px(mIndicatorStyle == STYLE_BLOCK ? 7 : 0));
    mIndicatorGravity = ta.getInt(R.styleable.SlidingTabLayout_tl_indicator_gravity, Gravity.BOTTOM);
    mIndicatorWidthEqualTitle = ta.getBoolean(R.styleable.SlidingTabLayout_tl_indicator_width_equal_title, false);

    mUnderlineColor = ta.getColor(R.styleable.SlidingTabLayout_tl_underline_color, Color.parseColor("#ffffff"));
    mUnderlineHeight = ta.getDimension(R.styleable.SlidingTabLayout_tl_underline_height, dp2px(0));
    mUnderlineGravity = ta.getInt(R.styleable.SlidingTabLayout_tl_underline_gravity, Gravity.BOTTOM);

    mDividerColor = ta.getColor(R.styleable.SlidingTabLayout_tl_divider_color, Color.parseColor("#ffffff"));
    mDividerWidth = ta.getDimension(R.styleable.SlidingTabLayout_tl_divider_width, dp2px(0));
    mDividerPadding = ta.getDimension(R.styleable.SlidingTabLayout_tl_divider_padding, dp2px(12));

    mTextsize = ta.getDimension(R.styleable.SlidingTabLayout_tl_textsize, sp2px(14));
    mTextSelectColor = ta.getColor(R.styleable.SlidingTabLayout_tl_textSelectColor, Color.parseColor("#ffffff"));
    mTextUnselectColor = ta.getColor(R.styleable.SlidingTabLayout_tl_textUnselectColor, Color.parseColor("#AAffffff"));
    mTextBold = ta.getInt(R.styleable.SlidingTabLayout_tl_textBold, TEXT_BOLD_NONE);
    mTextAllCaps = ta.getBoolean(R.styleable.SlidingTabLayout_tl_textAllCaps, false);

    mTabSpaceEqual = ta.getBoolean(R.styleable.SlidingTabLayout_tl_tab_space_equal, false);
    mTabWidth = ta.getDimension(R.styleable.SlidingTabLayout_tl_tab_width, dp2px(-1));
    mTabPadding = ta.getDimension(R.styleable.SlidingTabLayout_tl_tab_padding, mTabSpaceEqual || mTabWidth > 0 ? dp2px(0) : dp2px(20));

    ta.recycle();
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:37,代码来源:SlidingTabLayout.java

示例9: handleArgs

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void handleArgs(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
	resetDefaults();

	final TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CardStackLayout, defStyleAttr,
			defStyleRes);
	mParallaxEnabled = a.getBoolean(R.styleable.CardStackLayout_parallax_enabled, PARALLAX_ENABLED_DEFAULT);
	mShowInitAnimation = a.getBoolean(R.styleable.CardStackLayout_showInitAnimation, SHOW_INIT_ANIMATION_DEFAULT);
	mParallaxScale = a.getInteger(R.styleable.CardStackLayout_parallax_scale,
			getResources().getInteger(R.integer.parallax_scale_default));
	mCardGap = a.getDimension(R.styleable.CardStackLayout_card_gap, getResources().getDimension(R.dimen.card_gap));
	mCardGapBottom = a.getDimension(R.styleable.CardStackLayout_card_gap_bottom,
			getResources().getDimension(R.dimen.card_gap_bottom));

	a.recycle();
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:16,代码来源:CardStackLayout.java

示例10: TabTitleView

import android.content.res.TypedArray; //导入方法依赖的package包/类
public TabTitleView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);
    mInflater = LayoutInflater.from(context);
    initView();

    if (attrs != null) {
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TabTitleView, defStyleAttr, defStyleRes);
        left_ImagViewDrawble = a.getDrawable(R.styleable.TabTitleView_leftImageIcon);
        if (left_ImagViewDrawble == null) {
            left_ImagViewDrawble = getResources().getDrawable(R.drawable.up_arrow, null);
        } else {
            setleft_ImagViewDrawable(left_ImagViewDrawble);
        }
        showRightTextView = a.getBoolean(R.styleable.TabTitleView_showRightTextView, false);
        if (showRightTextView) {
            setRigtTvVisiable(View.VISIBLE);
        } else {
            setRigtTvVisiable(View.GONE);
        }

        int rightTvcolor = a.getColor(R.styleable.TabTitleView_rightTvColor, getResources()
                .getColor(R.color.white));
        setRigtTvColor(rightTvcolor);

        String title = a.getString(R.styleable.TabTitleView_titleText);
        String rightTvText = a.getString(R.styleable.TabTitleView_rightText);

        setTitleText(title);

        setRigtTvText(rightTvText);

        a.recycle();

    }
    initListener();

}
 
开发者ID:yiwent,项目名称:Mobike,代码行数:38,代码来源:TabTitleView.java

示例11: obtainAttributes

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void obtainAttributes(Context context, AttributeSet attrs) {
    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SegmentTabLayout);

    mIndicatorColor = ta.getColor(R.styleable.SegmentTabLayout_tl_indicator_color, Color.parseColor("#222831"));
    mIndicatorHeight = ta.getDimension(R.styleable.SegmentTabLayout_tl_indicator_height, -1);
    mIndicatorCornerRadius = ta.getDimension(R.styleable.SegmentTabLayout_tl_indicator_corner_radius, -1);
    mIndicatorMarginLeft = ta.getDimension(R.styleable.SegmentTabLayout_tl_indicator_margin_left, dp2px(0));
    mIndicatorMarginTop = ta.getDimension(R.styleable.SegmentTabLayout_tl_indicator_margin_top, 0);
    mIndicatorMarginRight = ta.getDimension(R.styleable.SegmentTabLayout_tl_indicator_margin_right, dp2px(0));
    mIndicatorMarginBottom = ta.getDimension(R.styleable.SegmentTabLayout_tl_indicator_margin_bottom, 0);
    mIndicatorAnimEnable = ta.getBoolean(R.styleable.SegmentTabLayout_tl_indicator_anim_enable, false);
    mIndicatorBounceEnable = ta.getBoolean(R.styleable.SegmentTabLayout_tl_indicator_bounce_enable, true);
    mIndicatorAnimDuration = ta.getInt(R.styleable.SegmentTabLayout_tl_indicator_anim_duration, -1);

    mDividerColor = ta.getColor(R.styleable.SegmentTabLayout_tl_divider_color, mIndicatorColor);
    mDividerWidth = ta.getDimension(R.styleable.SegmentTabLayout_tl_divider_width, dp2px(1));
    mDividerPadding = ta.getDimension(R.styleable.SegmentTabLayout_tl_divider_padding, 0);

    mTextsize = ta.getDimension(R.styleable.SegmentTabLayout_tl_textsize, sp2px(13f));
    mTextSelectColor = ta.getColor(R.styleable.SegmentTabLayout_tl_textSelectColor, Color.parseColor("#ffffff"));
    mTextUnselectColor = ta.getColor(R.styleable.SegmentTabLayout_tl_textUnselectColor, mIndicatorColor);
    mTextBold = ta.getInt(R.styleable.SegmentTabLayout_tl_textBold, TEXT_BOLD_NONE);
    mTextAllCaps = ta.getBoolean(R.styleable.SegmentTabLayout_tl_textAllCaps, false);

    mTabSpaceEqual = ta.getBoolean(R.styleable.SegmentTabLayout_tl_tab_space_equal, true);
    mTabWidth = ta.getDimension(R.styleable.SegmentTabLayout_tl_tab_width, dp2px(-1));
    mTabPadding = ta.getDimension(R.styleable.SegmentTabLayout_tl_tab_padding, mTabSpaceEqual || mTabWidth > 0 ? dp2px(0) : dp2px(10));

    mBarColor = ta.getColor(R.styleable.SegmentTabLayout_tl_bar_color, Color.TRANSPARENT);
    mBarStrokeColor = ta.getColor(R.styleable.SegmentTabLayout_tl_bar_stroke_color, mIndicatorColor);
    mBarStrokeWidth = ta.getDimension(R.styleable.SegmentTabLayout_tl_bar_stroke_width, dp2px(1));

    ta.recycle();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:SegmentTabLayout.java

示例12: create

import android.content.res.TypedArray; //导入方法依赖的package包/类
/**
 * Creates a new instance of {@code AutofitHelper} that wraps a {@link TextView} and enables
 * automatically sizing the text to fit.
 */
public static AutofitHelper create(TextView view, AttributeSet attrs, int defStyle) {
    AutofitHelper helper = new AutofitHelper(view);
    boolean sizeToFit = true;
    if (attrs != null) {
        Context context = view.getContext();
        int minTextSize = (int) helper.getMinTextSize();
        float precision = helper.getPrecision();

        TypedArray ta = context.obtainStyledAttributes(
                attrs,
                R.styleable.AutofitEditText,
                defStyle,
                0);
        sizeToFit = ta.getBoolean(R.styleable.AutofitEditText_sizeToFit, sizeToFit);
        minTextSize = ta.getDimensionPixelSize(R.styleable.AutofitEditText_minTextSize,
                minTextSize);
        precision = ta.getFloat(R.styleable.AutofitEditText_precision, precision);
        ta.recycle();

        helper.setMinTextSize(TypedValue.COMPLEX_UNIT_PX, minTextSize)
                .setPrecision(precision);
    }
    helper.setEnabled(sizeToFit);

    return helper;
}
 
开发者ID:victorminerva,项目名称:AutoResizeEditText,代码行数:31,代码来源:AutofitHelper.java

示例13: SolidPadLayout

import android.content.res.TypedArray; //导入方法依赖的package包/类
public SolidPadLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (attrs != null) {
        final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SolidLayout, 0, 0);
        mPreventParentTouchEvents = a.getBoolean(R.styleable.SolidLayout_preventParentTouchEvents, mPreventParentTouchEvents);
        mPreventChildTouchEvents = a.getBoolean(R.styleable.SolidLayout_preventChildTouchEvents, mPreventChildTouchEvents);
        a.recycle();
    }
}
 
开发者ID:tranleduy2000,项目名称:floating_calc,代码行数:11,代码来源:SolidPadLayout.java

示例14: init

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    mScaleTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mMaxVelocity = ViewConfiguration.get(context).getScaledMaximumFlingVelocity();
    //初始化滑动帮助类对象
    //mScroller = new Scroller(context);

    //右滑删除功能的开关,默认开
    isSwipeEnable = true;
    //IOS、QQ式交互,默认开
    isIos = true;
    //左滑右滑的开关,默认左滑打开菜单
    isLeftSwipe = true;
    TypedArray ta = context.getTheme().obtainStyledAttributes(attrs, R.styleable.SwipeMenuLayout, defStyleAttr, 0);
    int count = ta.getIndexCount();
    for (int i = 0; i < count; i++) {
        int attr = ta.getIndex(i);
        //如果引用成AndroidLib 资源都不是常量,无法使用switch case
        if (attr == R.styleable.SwipeMenuLayout_swipeEnable) {
            isSwipeEnable = ta.getBoolean(attr, true);
        } else if (attr == R.styleable.SwipeMenuLayout_ios) {
            isIos = ta.getBoolean(attr, true);
        } else if (attr == R.styleable.SwipeMenuLayout_leftSwipe) {
            isLeftSwipe = ta.getBoolean(attr, true);
        }
    }
    ta.recycle();


}
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:30,代码来源:SwipeMenuLayout.java

示例15: initAttrs

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void initAttrs(Context context, AttributeSet attrs, int defStyleAttr) {
    mIndicatorHeight = (int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, mMetrics);
    mUnderlineHeight = (int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, mMetrics);
    mDividerWidth = (int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, mMetrics);
    mDividerPaddingTop = (int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, mMetrics);
    mDividerPaddingBottom = (int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, mMetrics);
    mTabPaddingLeft = (int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, mMetrics);
    mTabPaddingRight = (int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, mMetrics);
    mTabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, mMetrics);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HorizontalTabBar,
            defStyleAttr, 0);
    mIndicatorColor = a.getColor(R.styleable.HorizontalTabBar_horizontaltabbar_indicatorColor,
            DEFAULT_INDICATOR_COLOR);
    mUnderlineColor = a.getColor(R.styleable.HorizontalTabBar_horizontaltabbar_underlineColor,
            DEFAULT_UNDERLINE_COLOR);
    mDividerColor = a.getColor(R.styleable.HorizontalTabBar_horizontaltabbar_dividerColor,
            DEFAULT_DIVIDER_COLOR);
    mIndicatorHeight = a.getDimensionPixelSize(
            R.styleable.HorizontalTabBar_horizontaltabbar_indicatorHeight, mIndicatorHeight);
    mUnderlineHeight = a.getDimensionPixelSize(
            R.styleable.HorizontalTabBar_horizontaltabbar_underlineHeight, mUnderlineHeight);
    mDividerPaddingTop = a.getDimensionPixelSize(
            R.styleable.HorizontalTabBar_horizontaltabbar_dividerPaddingTop,
            mDividerPaddingTop);
    mDividerPaddingBottom = a.
            getDimensionPixelSize(
                    R.styleable.HorizontalTabBar_horizontaltabbar_dividerPaddingBottom,
                    mDividerPaddingBottom);
    mTabPaddingLeft = a.getDimensionPixelSize(
            R.styleable.HorizontalTabBar_horizontaltabbar_tabPaddingLeft, mTabPaddingLeft);
    mTabPaddingRight = a.getDimensionPixelSize(
            R.styleable.HorizontalTabBar_horizontaltabbar_tabPaddingRight, mTabPaddingRight);
    mTabColor = a.getResourceId(R.styleable.HorizontalTabBar_horizontaltabbar_tabColor,
            DEFAULT_TAB_COLOR);
    mTabTextColor = a.getColor(R.styleable.HorizontalTabBar_horizontaltabbar_tabTextColor,
            DEFAULT_TAB_TEXT_COLOR);
    mSelectedTabTextColor = a.getColor(
            R.styleable.HorizontalTabBar_horizontaltabbar_tabSelectedTextColor,
            DEFAULT_SELECTED_TAB_TEXT_COLOR);
    mTabTextSize = a.getDimension(
            R.styleable.HorizontalTabBar_horizontaltabbar_tabTextSize, mTabTextSize);
    mAverage = a.getBoolean(R.styleable.HorizontalTabBar_horizontaltabbar_isAverage, mAverage);
    mTextAllCaps = a.getBoolean(R.styleable.HorizontalTabBar_horizontaltabbar_textAllCaps,
            mTextAllCaps);
    a.recycle();
}
 
开发者ID:JackWHLiu,项目名称:jackknife,代码行数:54,代码来源:HorizontalTabBar.java


注:本文中的android.content.res.TypedArray.getBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。