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


Java TypedArray.getDimensionPixelSize方法代码示例

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


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

示例1: BezierRoundView

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

    mRadius = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, getResources().getDisplayMetrics());  //Ĭ������15dp

    // ��ȡ�Զ�����ʽ����
    TypedArray array = context.getTheme().obtainStyledAttributes(attrs, R.styleable.BezierRoundView, defStyleAttr, 0);
    color_select = array.getColor(R.styleable.BezierRoundView_color_select, color_select);
    color_touch = array.getColor(R.styleable.BezierRoundView_color_touch, color_touch);
    color_default = array.getColor(R.styleable.BezierRoundView_color_not_select, color_default);
    time_animator = array.getInteger(R.styleable.BezierRoundView_time_animator, time_animator);
    default_round_count = array.getInteger(R.styleable.BezierRoundView_round_count, default_round_count);
    mRadius = array.getDimensionPixelSize(R.styleable.BezierRoundView_radius, mRadius);
    mDistance = array.getDimensionPixelSize(R.styleable.BezierRoundView_distance, mDistance);
    array.recycle();

    init();
}
 
开发者ID:RealMoMo,项目名称:BezierRoundView,代码行数:19,代码来源:BezierRoundView .java

示例2: init

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs) {
    this.context = context;
    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.EaseContactList);
    primaryColor = ta.getColor(R.styleable.EaseContactList_ctsListPrimaryTextColor, 0);
    primarySize = ta.getDimensionPixelSize(R.styleable.EaseContactList_ctsListPrimaryTextSize, 0);
    showSiderBar = ta.getBoolean(R.styleable.EaseContactList_ctsListShowSiderBar, true);
    initialLetterBg = ta.getDrawable(R.styleable.EaseContactList_ctsListInitialLetterBg);
    initialLetterColor = ta.getColor(R.styleable.EaseContactList_ctsListInitialLetterColor, 0);
    ta.recycle();
    
    
    LayoutInflater.from(context).inflate(R.layout.ease_widget_contact_list, this);
    listView = (ListView)findViewById(R.id.list);
    sidebar = (EaseSidebar) findViewById(R.id.sidebar);
    if(!showSiderBar)
        sidebar.setVisibility(View.GONE);
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:18,代码来源:EaseContactList.java

示例3: CircleImageView

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

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0);

    mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_civ_border_width, DEFAULT_BORDER_WIDTH);
    mBorderColor = a.getColor(R.styleable.CircleImageView_civ_border_color, DEFAULT_BORDER_COLOR);
    mBorderOverlay = a.getBoolean(R.styleable.CircleImageView_civ_border_overlay, DEFAULT_BORDER_OVERLAY);
    mFillColor = a.getColor(R.styleable.CircleImageView_civ_fill_color, DEFAULT_FILL_COLOR);

    a.recycle();

    init();
}
 
开发者ID:raj10071997,项目名称:Alexa-Voice-Service,代码行数:15,代码来源:CircleImageView.java

示例4: init

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void init(AttributeSet attrs, int defStyle) {
	final TypedArray a = getContext().obtainStyledAttributes(attrs,
			R.styleable.ColorBars, defStyle, 0);
	final Resources b = getContext().getResources();

	mBarThickness = a.getDimensionPixelSize(
			R.styleable.ColorBars_bar_thickness,
			b.getDimensionPixelSize(R.dimen.bar_thickness));
	mBarLength = a.getDimensionPixelSize(R.styleable.ColorBars_bar_length,
			b.getDimensionPixelSize(R.dimen.bar_length));
	mPreferredBarLength = mBarLength;
	mBarPointerRadius = a.getDimensionPixelSize(
			R.styleable.ColorBars_bar_pointer_radius,
			b.getDimensionPixelSize(R.dimen.bar_pointer_radius));
	mBarPointerHaloRadius = a.getDimensionPixelSize(
			R.styleable.ColorBars_bar_pointer_halo_radius,
			b.getDimensionPixelSize(R.dimen.bar_pointer_halo_radius));
	mOrientation = a.getBoolean(
			R.styleable.ColorBars_bar_orientation_horizontal, ORIENTATION_DEFAULT);

	a.recycle();

	mBarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mBarPaint.setShader(shader);

	mBarPointerPosition = mBarLength + mBarPointerHaloRadius;

	mBarPointerHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mBarPointerHaloPaint.setColor(Color.BLACK);
	mBarPointerHaloPaint.setAlpha(0x50);

	mBarPointerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mBarPointerPaint.setColor(0xff81ff00);

	mPosToSatFactor = 1 / ((float) mBarLength);
	mSatToPosFactor = ((float) mBarLength) / 1;
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:38,代码来源:SaturationBar.java

示例5: loadTextSizeFromTextAppearance

import android.content.res.TypedArray; //导入方法依赖的package包/类
private int loadTextSizeFromTextAppearance(int textAppearanceResId)
{
    TypedArray a = getContext().obtainStyledAttributes(textAppearanceResId,
            R.styleable.TextAppearance);

    try
    {
        if (!DimenUtils.isPxVal(a.peekValue(R.styleable.TextAppearance_android_textSize)))
            return NO_VALID;
        return a.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, NO_VALID);
    } finally
    {
        a.recycle();
    }
}
 
开发者ID:Wan7451,项目名称:mvparms,代码行数:16,代码来源:AutoTabLayout.java

示例6: initCropFrameStyle

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void initCropFrameStyle(@NonNull TypedArray a) {
    int cropFrameStrokeSize = a.getDimensionPixelSize(R.styleable
            .ucrop_UCropView_ucrop_frame_stroke_size, getResources().getDimensionPixelSize(R
            .dimen.ucrop_default_crop_frame_stoke_width));
    int cropFrameColor = a.getColor(R.styleable.ucrop_UCropView_ucrop_frame_color,
            getResources().getColor(R.color.ucrop_color_default_crop_frame));
    this.mCropFramePaint.setStrokeWidth((float) cropFrameStrokeSize);
    this.mCropFramePaint.setColor(cropFrameColor);
    this.mCropFramePaint.setStyle(Style.STROKE);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:OverlayView.java

示例7: 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.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:HK-SHAO,项目名称:DarkCalculator,代码行数:31,代码来源:AutofitHelper.java

示例8: CommonTabLayout

import android.content.res.TypedArray; //导入方法依赖的package包/类
public CommonTabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setWillNotDraw(false);//重写onDraw方法,需要调用这个方法来清除flag
    setClipChildren(false);
    setClipToPadding(false);

    this.mContext = context;
    mTabsContainer = new LinearLayout(context);
    addView(mTabsContainer);

    obtainAttributes(context, attrs);

    //get layout_height
    String height = attrs.getAttributeValue("http://schemas.android.com/apk/res/android", "layout_height");

    //create ViewPager
    if (height.equals(ViewGroup.LayoutParams.MATCH_PARENT + "")) {
    } else if (height.equals(ViewGroup.LayoutParams.WRAP_CONTENT + "")) {
    } else {
        int[] systemAttrs = {android.R.attr.layout_height};
        TypedArray a = context.obtainStyledAttributes(attrs, systemAttrs);
        mHeight = a.getDimensionPixelSize(0, ViewGroup.LayoutParams.WRAP_CONTENT);
        a.recycle();
    }

    mValueAnimator = ValueAnimator.ofObject(new PointEvaluator(), mLastP, mCurrentP);
    mValueAnimator.addUpdateListener(this);
}
 
开发者ID:LonelyMushroom,项目名称:aarLibrary,代码行数:29,代码来源:CommonTabLayout.java

示例9: MaterialRippleLayout

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

    setWillNotDraw(false);
    gestureDetector = new GestureDetector(context, longClickListener);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialRippleLayout);
    rippleColor = a.getColor(R.styleable.MaterialRippleLayout_mrl_rippleColor, DEFAULT_COLOR);
    rippleDiameter = a.getDimensionPixelSize(
        R.styleable.MaterialRippleLayout_mrl_rippleDimension,
        (int) dpToPx(getResources(), DEFAULT_DIAMETER_DP)
    );
    rippleOverlay = a.getBoolean(R.styleable.MaterialRippleLayout_mrl_rippleOverlay, DEFAULT_RIPPLE_OVERLAY);
    rippleHover = a.getBoolean(R.styleable.MaterialRippleLayout_mrl_rippleHover, DEFAULT_HOVER);
    rippleDuration = a.getInt(R.styleable.MaterialRippleLayout_mrl_rippleDuration, DEFAULT_DURATION);
    rippleAlpha = (int) (255 * a.getFloat(R.styleable.MaterialRippleLayout_mrl_rippleAlpha, DEFAULT_ALPHA));
    rippleDelayClick = a.getBoolean(R.styleable.MaterialRippleLayout_mrl_rippleDelayClick, DEFAULT_DELAY_CLICK);
    rippleFadeDuration = a.getInteger(R.styleable.MaterialRippleLayout_mrl_rippleFadeDuration, DEFAULT_FADE_DURATION);
    rippleBackground = new ColorDrawable(a.getColor(R.styleable.MaterialRippleLayout_mrl_rippleBackground, DEFAULT_BACKGROUND));
    ripplePersistent = a.getBoolean(R.styleable.MaterialRippleLayout_mrl_ripplePersistent, DEFAULT_PERSISTENT);
    rippleInAdapter = a.getBoolean(R.styleable.MaterialRippleLayout_mrl_rippleInAdapter, DEFAULT_SEARCH_ADAPTER);
    rippleRoundedCorners = a.getDimensionPixelSize(R.styleable.MaterialRippleLayout_mrl_rippleRoundedCorners, DEFAULT_ROUNDED_CORNERS);

    a.recycle();

    paint.setColor(rippleColor);
    paint.setAlpha(rippleAlpha);

    enableClipPathSupportIfNecessary();
}
 
开发者ID:yangchong211,项目名称:YCUtils,代码行数:31,代码来源:MaterialRippleLayout.java

示例10: QMUIRadiusImageView

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

    mBorderPaint = new Paint();
    mBorderPaint.setAntiAlias(true);
    mBorderPaint.setStyle(Paint.Style.STROKE);
    mMatrix = new Matrix();

    setScaleType(ScaleType.CENTER_CROP);

    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.QMUIRadiusImageView, defStyleAttr, 0);

    mBorderWidth = array.getDimensionPixelSize(R.styleable.QMUIRadiusImageView_qmui_border_width, 0);
    mBorderColor = array.getColor(R.styleable.QMUIRadiusImageView_qmui_border_color, DEFAULT_BORDER_COLOR);
    mSelectedBorderWidth = array.getDimensionPixelSize(
            R.styleable.QMUIRadiusImageView_qmui_selected_border_width, mBorderWidth);
    mSelectedBorderColor = array.getColor(R.styleable.QMUIRadiusImageView_qmui_selected_border_color, mBorderColor);
    mSelectedMaskColor = array.getColor(R.styleable.QMUIRadiusImageView_qmui_selected_mask_color, Color.TRANSPARENT);
    if (mSelectedMaskColor != Color.TRANSPARENT) {
        mSelectedColorFilter = new PorterDuffColorFilter(mSelectedMaskColor, PorterDuff.Mode.DARKEN);
    }

    mIsTouchSelectModeEnabled = array.getBoolean(R.styleable.QMUIRadiusImageView_qmui_is_touch_select_mode_enabled, true);
    mIsCircle = array.getBoolean(R.styleable.QMUIRadiusImageView_qmui_is_circle, false);
    if (!mIsCircle) {
        mIsOval = array.getBoolean(R.styleable.QMUIRadiusImageView_qmui_is_oval, false);
    }
    if (!mIsOval) {
        mCornerRadius = array.getDimensionPixelSize(R.styleable.QMUIRadiusImageView_qmui_corner_radius, 0);
    }
    array.recycle();
}
 
开发者ID:coopese,项目名称:qmui,代码行数:33,代码来源:QMUIRadiusImageView.java

示例11: setAttrs

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void setAttrs(Context context, AttributeSet attrs) {
    if (attrs == null) {
        return;
    }

    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.AnimatedRatingBar);
    int progressImageResource = ta.getResourceId(R.styleable.AnimatedRatingBar_progressImage, R.id.progress_image);
    int secondaryProgressImageResource = ta.getResourceId(R.styleable.AnimatedRatingBar_secondaryProgressImage, R.id.secondary_progress_image);

    if (progressImageResource != 0) {
        progressImage = getResources().getDrawable(progressImageResource);
    }

    if (secondaryProgressImageResource != 0) {
        secondaryProgressImage = getResources().getDrawable(secondaryProgressImageResource);
    }


    numStars = ta.getInt(R.styleable.AnimatedRatingBar_numStars, 5);
    max = ta.getInt(R.styleable.AnimatedRatingBar_max, 5);
    rating = ta.getFloat(R.styleable.AnimatedRatingBar_rating, 2.5f);
    gapSize = ta.getDimensionPixelSize(R.styleable.AnimatedRatingBar_gapSize, 20);
    starSize = ta.getDimensionPixelSize(R.styleable.AnimatedRatingBar_starSize, 30);
    seekable = ta.getBoolean(R.styleable.AnimatedRatingBar_seekable, false);

    ta.recycle();
}
 
开发者ID:bigstark,项目名称:animated-ratingbar,代码行数:28,代码来源:AnimatedRatingBar.java

示例12: applyAttrs

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void applyAttrs(AttributeSet attrs) {
    if (attrs != null) {
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ArcLayout, 0, 0);

        float fromDegrees = a.getFloat(R.styleable.ArcLayout_fromDegrees, ArcLayout.DEFAULT_FROM_DEGREES);
        float toDegrees = a.getFloat(R.styleable.ArcLayout_toDegrees, ArcLayout.DEFAULT_TO_DEGREES);
        mArcLayout.setArc(fromDegrees, toDegrees);

        int defaultChildSize = mArcLayout.getChildSize();
        int newChildSize = a.getDimensionPixelSize(R.styleable.ArcLayout_childSize, defaultChildSize);
        mArcLayout.setChildSize(newChildSize);

        a.recycle();
    }
}
 
开发者ID:cheenid,项目名称:FLFloatingButton,代码行数:16,代码来源:ArcMenu.java

示例13: TransIndicator

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

    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.TransIndicator);
    mLeftMargin =  ta.getDimensionPixelSize(R.styleable.TransIndicator_trans_leftmargin,20);
    mTransWidht =  ta.getDimensionPixelSize(R.styleable.TransIndicator_trans_width,mTransWidht);
    mTransHeight =  ta.getDimensionPixelSize(R.styleable.TransIndicator_trans_height,mTransHeight);
    mDefaultcolor = ta.getColor(R.styleable.TransIndicator_trans_defaultcolor,
            mDefaultcolor);
    mMovecolor = ta.getColor(R.styleable.TransIndicator_trans_movecolor,
           mMovecolor);
    mDismissOpen = ta.getBoolean(R.styleable.TransIndicator_trans_dismiss_open,false);
    mTransType = ta.getInteger(R.styleable.TransIndicator_trans_type,TRANS_CIRCLE);
    mRoundRadius = ta.getDimensionPixelSize(R.styleable.TransIndicator_trans_round_radius,7);
    ta.recycle();


    setGravity(Gravity.CENTER);
    mPath = new Path();
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(mMovecolor);
    setClipChildren(false);
    setClipToPadding(false);

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

示例14: CircleRangeView

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

    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CircleRangeView);

    rangeColorArray = typedArray.getTextArray(R.styleable.CircleRangeView_rangeColorArray);
    rangeValueArray = typedArray.getTextArray(R.styleable.CircleRangeView_rangeValueArray);
    rangeTextArray = typedArray.getTextArray(R.styleable.CircleRangeView_rangeTextArray);

    borderColor = typedArray.getColor(R.styleable.CircleRangeView_borderColor, borderColor);
    cursorColor = typedArray.getColor(R.styleable.CircleRangeView_cursorColor, cursorColor);
    extraTextColor = typedArray.getColor(R.styleable.CircleRangeView_extraTextColor, extraTextColor);

    rangeTextSize = typedArray.getDimensionPixelSize(R.styleable.CircleRangeView_rangeTextSize, rangeTextSize);
    extraTextSize = typedArray.getDimensionPixelSize(R.styleable.CircleRangeView_extraTextSize, extraTextSize);

    typedArray.recycle();

    if (rangeColorArray == null || rangeValueArray == null || rangeTextArray == null) {
        throw new IllegalArgumentException("CircleRangeView : rangeColorArray、 rangeValueArray、rangeTextArray  must be not null ");
    }
    if (rangeColorArray.length != rangeValueArray.length
            || rangeColorArray.length != rangeTextArray.length
            || rangeValueArray.length != rangeTextArray.length) {
        throw new IllegalArgumentException("arrays must be equal length");
    }

    this.mSection = rangeColorArray.length;

    mSparkleWidth = dp2px(15);
    mCalibrationWidth = dp2px(10);

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setStrokeCap(Paint.Cap.ROUND);

    mRectFProgressArc = new RectF();
    mRectFCalibrationFArc = new RectF();
    mRectText = new Rect();

    mBackgroundColor = android.R.color.transparent;
}
 
开发者ID:WangGanxin,项目名称:CircleRangeView,代码行数:43,代码来源:CircleRangeView.java

示例15: init

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs) {
    TypedArray attr = context.obtainStyledAttributes(attrs, R.styleable.FloatingActionMenu, 0, 0);
    mOpenRotationLeft = attr.getInt(R.styleable.FloatingActionMenu_menu_fab_open_rotation_left, (int)OPENED_PLUS_ROTATION_LEFT);
    mOpenRotationRight = attr.getInt(R.styleable.FloatingActionMenu_menu_fab_open_rotation_right, (int)OPENED_PLUS_ROTATION_RIGHT);
    mAnimationDuration = attr.getInt((int)getAnimDuration(R.styleable.FloatingActionMenu_menu_fab_animation_duration, context), (int)getAnimDuration(ANIMATION_DURATION, context));
    mButtonSpacing = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_buttonSpacing, mButtonSpacing);
    mLabelsMargin = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_margin, mLabelsMargin);
    mLabelsPosition = attr.getInt(R.styleable.FloatingActionMenu_menu_labels_position, LABELS_POSITION_LEFT);
    mLabelsShowAnimation = attr.getResourceId(R.styleable.FloatingActionMenu_menu_labels_showAnimation,
            mLabelsPosition == LABELS_POSITION_LEFT ? R.anim.fab_slide_in_from_right : R.anim.fab_slide_in_from_left);
    mLabelsHideAnimation = attr.getResourceId(R.styleable.FloatingActionMenu_menu_labels_hideAnimation,
            mLabelsPosition == LABELS_POSITION_LEFT ? R.anim.fab_slide_out_to_right : R.anim.fab_slide_out_to_left);
    mLabelsPaddingTop = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_paddingTop, mLabelsPaddingTop);
    mLabelsPaddingRight = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_paddingRight, mLabelsPaddingRight);
    mLabelsPaddingBottom = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_paddingBottom, mLabelsPaddingBottom);
    mLabelsPaddingLeft = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_paddingLeft, mLabelsPaddingLeft);
    mLabelsTextColor = attr.getColorStateList(R.styleable.FloatingActionMenu_menu_labels_textColor);
    // set default value if null same as for textview
    if (mLabelsTextColor == null) {
        mLabelsTextColor = ColorStateList.valueOf(Color.WHITE);
    }
    mLabelsTextSize = attr.getDimension(R.styleable.FloatingActionMenu_menu_labels_textSize, getResources().getDimension(R.dimen.labels_text_size));
    mLabelsCornerRadius = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_cornerRadius, mLabelsCornerRadius);
    mLabelsShowShadow = attr.getBoolean(R.styleable.FloatingActionMenu_menu_labels_showShadow, true);
    mLabelsColorNormal = attr.getColor(R.styleable.FloatingActionMenu_menu_labels_colorNormal, 0xFF333333);
    mLabelsColorPressed = attr.getColor(R.styleable.FloatingActionMenu_menu_labels_colorPressed, 0xFF444444);
    mLabelsColorRipple = attr.getColor(R.styleable.FloatingActionMenu_menu_labels_colorRipple, 0x66FFFFFF);
    mMenuShowShadow = attr.getBoolean(R.styleable.FloatingActionMenu_menu_showShadow, true);
    mMenuShadowColor = attr.getColor(R.styleable.FloatingActionMenu_menu_shadowColor, 0x66000000);
    mMenuShadowRadius = attr.getDimension(R.styleable.FloatingActionMenu_menu_shadowRadius, mMenuShadowRadius);
    mMenuShadowXOffset = attr.getDimension(R.styleable.FloatingActionMenu_menu_shadowXOffset, mMenuShadowXOffset);
    mMenuShadowYOffset = attr.getDimension(R.styleable.FloatingActionMenu_menu_shadowYOffset, mMenuShadowYOffset);
    mMenuColorNormal = attr.getColor(R.styleable.FloatingActionMenu_menu_colorNormal, 0xFFDA4336);
    mMenuColorPressed = attr.getColor(R.styleable.FloatingActionMenu_menu_colorPressed, 0xFFE75043);
    mMenuColorRipple = attr.getColor(R.styleable.FloatingActionMenu_menu_colorRipple, 0x99FFFFFF);
    mAnimationDelayPerItem = attr.getInt(R.styleable.FloatingActionMenu_menu_animationDelayPerItem, 50);
    try
    {
        mIcon = VectorDrawableCompat.create(attr.getResources(), attr.getResourceId(R.styleable.FloatingActionMenu_menu_icon, R.drawable.fab_add), null);
    } catch (Resources.NotFoundException e) {
        e.printStackTrace();
        mIcon = getResources().getDrawable(R.drawable.fab_add);
    }
    mLabelsSingleLine = attr.getBoolean(R.styleable.FloatingActionMenu_menu_labels_singleLine, false);
    mLabelsEllipsize = attr.getInt(R.styleable.FloatingActionMenu_menu_labels_ellipsize, 0);
    mLabelsMaxLines = attr.getInt(R.styleable.FloatingActionMenu_menu_labels_maxLines, -1);
    mMenuFabSize = attr.getInt(R.styleable.FloatingActionMenu_menu_fab_size, FloatingActionButton.SIZE_NORMAL);
    mLabelsStyle = attr.getResourceId(R.styleable.FloatingActionMenu_menu_labels_style, 0);
    String customFont = attr.getString(R.styleable.FloatingActionMenu_menu_labels_customFont);
    try {
        if (!TextUtils.isEmpty(customFont)) {
            mCustomTypefaceFromFont = Typeface.createFromAsset(getContext().getAssets(), customFont);
        }
    } catch (RuntimeException ex) {
        throw new IllegalArgumentException("Unable to load specified custom font: " + customFont, ex);
    }
    mOpenDirection = attr.getInt(R.styleable.FloatingActionMenu_menu_openDirection, OPEN_UP);
    mBackgroundColor = attr.getColor(R.styleable.FloatingActionMenu_menu_backgroundColor, Color.TRANSPARENT);

    if (attr.hasValue(R.styleable.FloatingActionMenu_menu_fab_label)) {
        mUsingMenuLabel = true;
        mMenuLabelText = attr.getString(R.styleable.FloatingActionMenu_menu_fab_label);
    }

    if (attr.hasValue(R.styleable.FloatingActionMenu_menu_labels_padding)) {
        int padding = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_padding, 0);
        initPadding(padding);
    }

    mOpenInterpolator = new OvershootInterpolator();
    mCloseInterpolator = new AnticipateInterpolator();
    mLabelsContext = new ContextThemeWrapper(getContext(), mLabelsStyle);

    initBackgroundDimAnimation();
    createMenuButton();
    initMenuButtonAnimations(attr);

    attr.recycle();
}
 
开发者ID:HueToYou,项目名称:ChatExchange-old,代码行数:80,代码来源:FloatingActionMenu.java


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