當前位置: 首頁>>代碼示例>>Java>>正文


Java TypedArray.getDimension方法代碼示例

本文整理匯總了Java中android.content.res.TypedArray.getDimension方法的典型用法代碼示例。如果您正苦於以下問題:Java TypedArray.getDimension方法的具體用法?Java TypedArray.getDimension怎麽用?Java TypedArray.getDimension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.res.TypedArray的用法示例。


在下文中一共展示了TypedArray.getDimension方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import android.content.res.TypedArray; //導入方法依賴的package包/類
private void init(@Nullable final AttributeSet attrs) {
    if (!isInEditMode()) {
        PrismojiManager.getInstance().verifyInstalled();
    }

    if (attrs == null) {
        emojiSize = (int) getTextSize();
    } else {
        final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.emoji);

        try {
            emojiSize = (int) a.getDimension(R.styleable.emoji_emojiSize, getTextSize());
        } finally {
            a.recycle();
        }
    }

    setText(getText());
}
 
開發者ID:apradanas,項目名稱:prismoji-android,代碼行數:20,代碼來源:PrismojiEditText.java

示例2: init

import android.content.res.TypedArray; //導入方法依賴的package包/類
public void init(Context context, AttributeSet attrs) {
    dotRadius = (int) TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP, 8, context.getResources().getDisplayMetrics()
    );
    lineWidth = (int) TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP, 4, context.getResources().getDisplayMetrics()
    );
    if (attrs != null) {
        TypedArray a = context.getTheme().obtainStyledAttributes(
                attrs,
                R.styleable.TimeLineView,
                0, 0);
        try {
            dotRadius = (int) a.getDimension(R.styleable.TimeLineView_dotRadius, dotRadius);
            lineWidth = (int) a.getDimension(R.styleable.TimeLineView_lineWidth, lineWidth);
        } finally {
            a.recycle();
        }
    }

    setOverScrollMode(OVER_SCROLL_NEVER);
    setHasFixedSize(true);
    setLayoutManager(new LinearLayoutManager(getContext()));
}
 
開發者ID:ivanfenenko,項目名稱:TimeLineSample,代碼行數:25,代碼來源:TimeLineView.java

示例3: FlowViewHorizontal

import android.content.res.TypedArray; //導入方法依賴的package包/類
public FlowViewHorizontal(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mContext = context;
    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.FlowViewHorizontal);
    bgRadius = ta.getDimension(R.styleable.FlowViewHorizontal_h_bg_radius, 10);
    proRadius = ta.getDimension(R.styleable.FlowViewHorizontal_h_pro_radius, 8);
    lineBgWidth = (int) ta.getDimension(R.styleable.FlowViewHorizontal_h_bg_width, 3f);
    bgColor = ta.getColor(R.styleable.FlowViewHorizontal_h_bg_color, Color.parseColor("#cdcbcc"));
    lineProWidth = (int) ta.getDimension(R.styleable.FlowViewHorizontal_h_pro_width, 2f);
    proColor = ta.getColor(R.styleable.FlowViewHorizontal_h_pro_color, Color.parseColor("#029dd5"));
    textPadding = (int) ta.getDimension(R.styleable.FlowViewHorizontal_h_text_padding, 20);
    timePadding = (int) ta.getDimension(R.styleable.FlowViewHorizontal_h_time_padding, 30);
    maxStep = ta.getInt(R.styleable.FlowViewHorizontal_h_max_step, 5);
    textSize = (int) ta.getDimension(R.styleable.FlowViewHorizontal_h_textsize, 20);
    proStep = ta.getInt(R.styleable.FlowViewHorizontal_h_pro_step, 1);
    ta.recycle();
    init();
}
 
開發者ID:JJS-CN,項目名稱:JBase,代碼行數:19,代碼來源:FlowViewHorizontal.java

示例4: DrawerArrowDrawable

import android.content.res.TypedArray; //導入方法依賴的package包/類
/**
 * @param context used to get the configuration for the drawable from
 */
public DrawerArrowDrawable(Context context) {
  mPaint.setStyle(Paint.Style.STROKE);
  mPaint.setStrokeJoin(Paint.Join.MITER);
  mPaint.setStrokeCap(Paint.Cap.BUTT);
  mPaint.setAntiAlias(true);

  final TypedArray a = context.getTheme().obtainStyledAttributes(null,
    R.styleable.DrawerArrowToggle, R.attr.drawerArrowStyle,
    R.style.Base_Widget_Material_DrawerArrowToggle);

  setColor(a.getColor(R.styleable.DrawerArrowToggle_color, 0));
  setBarThickness(a.getDimension(R.styleable.DrawerArrowToggle_thickness, 0));
  setSpinEnabled(a.getBoolean(R.styleable.DrawerArrowToggle_spinBars, true));
  // round this because having this floating may cause bad measurements
  setGapSize(Math.round(a.getDimension(R.styleable.DrawerArrowToggle_gapBetweenBars, 0)));

  mSize = a.getDimensionPixelSize(R.styleable.DrawerArrowToggle_drawableSize, 0);
  // round this because having this floating may cause bad measurements
  mBarLength = Math.round(a.getDimension(R.styleable.DrawerArrowToggle_barLength, 0));
  // round this because having this floating may cause bad measurements
  mArrowHeadLength = Math.round(a.getDimension(
    R.styleable.DrawerArrowToggle_arrowHeadLength, 0));
  mArrowShaftLength = a.getDimension(R.styleable.DrawerArrowToggle_arrowShaftLength, 0);
  a.recycle();
}
 
開發者ID:commonsguy,項目名稱:cwac-crossport,代碼行數:29,代碼來源:DrawerArrowDrawable.java

示例5: LinePageIndicator

import android.content.res.TypedArray; //導入方法依賴的package包/類
public LinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode()) return;

    final Resources res = getResources();

    //Load defaults from resources
    final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
    final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
    final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
    final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
    final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.LinePageIndicator_centered, defaultCentered);
    mLineWidth = a.getDimension(R.styleable.LinePageIndicator_lineWidth, defaultLineWidth);
    mGapWidth = a.getDimension(R.styleable.LinePageIndicator_gapWidth, defaultGapWidth);
    setStrokeWidth(a.getDimension(R.styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintUnselected.setColor(a.getColor(R.styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor));
    mPaintSelected.setColor(a.getColor(R.styleable.LinePageIndicator_selectedColor, defaultSelectedColor));

    Drawable background = a.getDrawable(R.styleable.LinePageIndicator_android_background);
    if (background != null) {
      setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:35,代碼來源:LinePageIndicator.java

示例6: getDisplayHeight

import android.content.res.TypedArray; //導入方法依賴的package包/類
public static int getDisplayHeight(AppCompatActivity activity) {
    int height = 0;
    if (activity != null && activity.getWindowManager() != null && activity.getWindowManager().getDefaultDisplay() != null) {
        Point point=new Point();
        activity.getWindowManager().getDefaultDisplay().getSize(point);
        height=point.y;
    }

    Log.e(TAG, "isSupportSmartBar:" + isSupportSmartBar);

    if (isSupportSmartBar) {
        int smartBarHeight = getSmartBarHeight(activity);
        Log.e(TAG, "smartBarHeight:" + smartBarHeight);
        height -= smartBarHeight;
    }

    if (activity.getSupportActionBar() != null) {
      int actionbar= activity.getSupportActionBar().getHeight();
      if(actionbar==0){
        TypedArray actionbarSizeTypedArray=activity.obtainStyledAttributes(new int[]{android.R.attr.actionBarSize});
        actionbar= (int) actionbarSizeTypedArray.getDimension(0,0);
      }
      Log.d(TAG, "actionbar:" + actionbar);
      height -= actionbar;
    }

    int status = getStatusBarHeight(activity);
    Log.d(TAG, "status:" + status);

    height -= status;

    Log.d(TAG,"height:"+height);
    return height;
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:35,代碼來源:ScreenUtil.java

示例7: init

import android.content.res.TypedArray; //導入方法依賴的package包/類
private void init(Context context,AttributeSet attrs){
    TypedArray typedArray = context.obtainStyledAttributes(attrs,R.styleable.CircleBarView);

    progressColor = typedArray.getColor(R.styleable.CircleBarView_progress_color,Color.GREEN);
    bgColor = typedArray.getColor(R.styleable.CircleBarView_bg_color,Color.GRAY);
    startAngle = typedArray.getFloat(R.styleable.CircleBarView_start_angle,0);
    sweepAngle = typedArray.getFloat(R.styleable.CircleBarView_sweep_angle,360);
    barWidth = typedArray.getDimension(R.styleable.CircleBarView_bar_width,DpOrPxUtils.dip2px(context,10));
    typedArray.recycle();

    progressNum = 0;
    maxNum = 100;
    defaultSize = DpOrPxUtils.dip2px(context,100);
    mRectF = new RectF();

    progressPaint = new Paint();
    progressPaint.setStyle(Paint.Style.STROKE);//隻描邊,不填充
    progressPaint.setColor(progressColor);
    progressPaint.setAntiAlias(true);//設置抗鋸齒
    progressPaint.setStrokeWidth(barWidth);
    progressPaint.setStrokeCap(Paint.Cap.ROUND);//設置畫筆為圓角

    bgPaint = new Paint();
    bgPaint.setStyle(Paint.Style.STROKE);//隻描邊,不填充
    bgPaint.setColor(bgColor);
    bgPaint.setAntiAlias(true);//設置抗鋸齒
    bgPaint.setStrokeWidth(barWidth);
    bgPaint.setStrokeCap(Paint.Cap.ROUND);

    anim = new CircleBarAnim();
}
 
開發者ID:AnliaLee,項目名稱:Progressbar,代碼行數:32,代碼來源:CircleBarView.java

示例8: init

import android.content.res.TypedArray; //導入方法依賴的package包/類
private void init(Context context, AttributeSet attrs) {
    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.RoundedImageView);
    float radius = ta.getDimension(R.styleable.RoundedImageView_roundRadius, 0);
    float radiusLeftTop = ta.getDimension(R.styleable.RoundedImageView_roundRadiusLeftTop, 0);
    float radiusRightTop = ta.getDimension(R.styleable.RoundedImageView_roundRadiusRightTop, 0);
    float radiusRightBottom = ta.getDimension(R.styleable.RoundedImageView_roundRadiusRightBottom, 0);
    float radiusLeftBottom = ta.getDimension(R.styleable.RoundedImageView_roundRadiusLeftBottom, 0);
    isCircle = ta.getBoolean(R.styleable.RoundedImageView_roundRadiusIsCircle, false);
    ta.recycle();

    if (radius != 0) {
        mRadius = new float[] { radius, radius, radius, radius };
    }

    boolean falg = (radiusLeftTop != 0) ? true : false;
    falg = (radiusRightTop != 0) ? true : falg;
    falg = (radiusRightBottom != 0) ? true : falg;
    falg = (radiusLeftBottom != 0) ? true : falg;

    if (falg) {
        mRadius = new float[] { radiusLeftTop, radiusRightTop, radiusRightBottom, radiusLeftBottom };
    }

    mPathFactory = new PathFactory();
    mPath = new Path();
    mBitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBitmapPaint.setDither(false);
}
 
開發者ID:A-Miracle,項目名稱:QiangHongBao,代碼行數:29,代碼來源:RoundedImageView.java

示例9: updateStateFromTypedArray

import android.content.res.TypedArray; //導入方法依賴的package包/類
private void updateStateFromTypedArray(TypedArray a, XmlPullParser parser) throws XmlPullParserException {
    VectorDrawableCompatState state = this.mVectorState;
    VPathRenderer pathRenderer = state.mVPathRenderer;
    state.mTintMode = parseTintModeCompat(TypedArrayUtils.getNamedInt(a, parser, "tintMode", 6, -1), Mode.SRC_IN);
    ColorStateList tint = a.getColorStateList(1);
    if (tint != null) {
        state.mTint = tint;
    }
    state.mAutoMirrored = TypedArrayUtils.getNamedBoolean(a, parser, "autoMirrored", 5, state.mAutoMirrored);
    pathRenderer.mViewportWidth = TypedArrayUtils.getNamedFloat(a, parser, "viewportWidth", 7, pathRenderer.mViewportWidth);
    pathRenderer.mViewportHeight = TypedArrayUtils.getNamedFloat(a, parser, "viewportHeight", 8, pathRenderer.mViewportHeight);
    if (pathRenderer.mViewportWidth <= 0.0f) {
        throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires viewportWidth > 0");
    } else if (pathRenderer.mViewportHeight <= 0.0f) {
        throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires viewportHeight > 0");
    } else {
        pathRenderer.mBaseWidth = a.getDimension(3, pathRenderer.mBaseWidth);
        pathRenderer.mBaseHeight = a.getDimension(2, pathRenderer.mBaseHeight);
        if (pathRenderer.mBaseWidth <= 0.0f) {
            throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires width > 0");
        } else if (pathRenderer.mBaseHeight <= 0.0f) {
            throw new XmlPullParserException(a.getPositionDescription() + "<vector> tag requires height > 0");
        } else {
            pathRenderer.setAlpha(TypedArrayUtils.getNamedFloat(a, parser, "alpha", 4, pathRenderer.getAlpha()));
            String name = a.getString(0);
            if (name != null) {
                pathRenderer.mRootName = name;
                pathRenderer.mVGTargetsMap.put(name, pathRenderer);
            }
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:33,代碼來源:VectorDrawableCompat.java

示例10: setTypeArray

import android.content.res.TypedArray; //導入方法依賴的package包/類
private void setTypeArray(TypedArray typeArray) {
    tag_textSize = typeArray.getInt(R.styleable.RibbonTag_tag_textSize, tag_textSize);
    tag_textColor = typeArray.getColor(R.styleable.RibbonTag_tag_textColor, tag_textColor);
    ribbonColor = typeArray.getColor(R.styleable.RibbonTag_tag_ribbonColor, ribbonColor);
    ribbonRadius = typeArray.getInt(R.styleable.RibbonTag_tag_ribbonRadius, ribbonRadius);
    padding_left = typeArray.getDimension(R.styleable.RibbonTag_tag_padding_left, padding_left);
    padding_top = typeArray.getDimension(R.styleable.RibbonTag_tag_padding_top, padding_top);
    padding_right = typeArray.getDimension(R.styleable.RibbonTag_tag_padding_right, padding_right);
    padding_bottom = typeArray.getDimension(R.styleable.RibbonTag_tag_padding_bottom, padding_bottom);
}
 
開發者ID:battleent,項目名稱:android-RibbonViews,代碼行數:11,代碼來源:RibbonTag.java

示例11: 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:767954322,項目名稱:FlycoTabLayout,代碼行數:37,代碼來源:SlidingTabLayout.java

示例12: parseAttributes

import android.content.res.TypedArray; //導入方法依賴的package包/類
/**
 * Parse the attributes passed to the view from the XML
 *
 * @param a the attributes to parse
 */
private void parseAttributes(TypedArray a) {
  // We transform the default values from DIP to pixels
  DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
  barWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, barWidth, metrics);
  rimWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, rimWidth, metrics);
  circleRadius =
      (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, circleRadius, metrics);

  circleRadius =
      (int) a.getDimension(R.styleable.ProgressWheel_matProg_circleRadius, circleRadius);

  fillRadius = a.getBoolean(R.styleable.ProgressWheel_matProg_fillRadius, false);

  barWidth = (int) a.getDimension(R.styleable.ProgressWheel_matProg_barWidth, barWidth);

  rimWidth = (int) a.getDimension(R.styleable.ProgressWheel_matProg_rimWidth, rimWidth);

  float baseSpinSpeed =
      a.getFloat(R.styleable.ProgressWheel_matProg_spinSpeed, spinSpeed / 360.0f);
  spinSpeed = baseSpinSpeed * 360;

  barSpinCycleTime =
      a.getInt(R.styleable.ProgressWheel_matProg_barSpinCycleTime, (int) barSpinCycleTime);

  barColor = a.getColor(R.styleable.ProgressWheel_matProg_barColor, barColor);

  rimColor = a.getColor(R.styleable.ProgressWheel_matProg_rimColor, rimColor);

  linearProgress = a.getBoolean(R.styleable.ProgressWheel_matProg_linearProgress, false);

  if (a.getBoolean(R.styleable.ProgressWheel_matProg_progressIndeterminate, false)) {
    spin();
  }

  // Recycle
  a.recycle();
}
 
開發者ID:sega4revenge,項目名稱:Sega,代碼行數:43,代碼來源:ProgressWheel.java

示例13: init

import android.content.res.TypedArray; //導入方法依賴的package包/類
/**
 * 初始化,獲取設置的屬性
 *
 * @param context
 * @param attrs
 */
private void init(Context context, AttributeSet attrs) {

    TypedArray attribute = context.obtainStyledAttributes(attrs,
            R.styleable.WheelView);
    unitHeight = (int) attribute.getDimension(
            R.styleable.WheelView_unitHight, 32);
    normalFont = attribute.getDimension(
            R.styleable.WheelView_normalTextSize, 14.0f);
    selectedFont = attribute.getDimension(
            R.styleable.WheelView_selectedTextSize, 22.0f);
    itemNumber = attribute.getInt(R.styleable.WheelView_itemNumber, 7);
    normalColor = attribute.getColor(
            R.styleable.WheelView_normalTextColor, 0xff000000);
    selectedColor = attribute.getColor(
            R.styleable.WheelView_selectedTextColor, 0xffff0000);
    lineColor = attribute.getColor(R.styleable.WheelView_lineColor,
            0xff000000);
    bottomLineColor = attribute.getColor(R.styleable.WheelView_bottomLineColor,
            0xffDADADA);
    lineWidth = attribute.getDimension(R.styleable.WheelView_lineHeight, 2f);
    firstLineAndSecondLineSpace = attribute.getDimension(R.styleable.WheelView_firstLineAndSecondLineSpace, 40f);
    maskHight = attribute.getDimension(R.styleable.WheelView_maskHight,
            48.0f);
    noEmpty = attribute.getBoolean(R.styleable.WheelView_noEmpty, true);
    isEnable = attribute
            .getBoolean(R.styleable.WheelView_isEnable, true);
    attribute.recycle();

    controlHeight = itemNumber * unitHeight;

}
 
開發者ID:abook23,項目名稱:godlibrary,代碼行數:38,代碼來源:WheelView.java

示例14: init

import android.content.res.TypedArray; //導入方法依賴的package包/類
private void init(Context context, AttributeSet attrs) {
    // set scroll mode
    setOverScrollMode(OVER_SCROLL_NEVER);

    if (null != attrs) {
        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.PullScrollView);

        if (ta != null) {
            mHeaderHeight = (int) ta.getDimension(R.styleable.PullScrollView_headerHeight, -1);
            mHeaderVisibleHeight = (int) ta.getDimension(R.styleable
                    .PullScrollView_headerVisibleHeight, -1);
            ta.recycle();
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:PullScrollView.java

示例15: RoundImageView

import android.content.res.TypedArray; //導入方法依賴的package包/類
public RoundImageView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    if (Build.VERSION.SDK_INT < 18) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    TypedArray array = context.getTheme().obtainStyledAttributes(attrs, R.styleable.RoundImageView, defStyleAttr, 0);
    imageRadius = (int) array.getDimension(R.styleable.RoundImageView_imageRadius, 4);
    imageRadius = dp2px(context, imageRadius);
    imagePosition = array.getInt(R.styleable.RoundImageView_imagePosition, 0);
    array.recycle();
}
 
開發者ID:Jusenr,項目名稱:AppFirCloud,代碼行數:12,代碼來源:RoundImageView.java


注:本文中的android.content.res.TypedArray.getDimension方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。