TypedArray getDimensionPixelSize - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TypedArray getDimensionPixelSize method.

This code example shows how to use the following methods:getDimensionPixelSize, getDrawable, getInteger, recycle
This code example shows how to use the following methods:getDimensionPixelSize, getDrawable, getInteger, recycle
This code example shows how to use the following methods:getDimensionPixelSize, getDrawable, getInteger, recycle
This code example shows how to use the following methods:getBoolean, getDimensionPixelSize, getDrawable, getInt, recycle
	public IcsLinearLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
 
        TypedArray a = context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/R_styleable_LinearLayout);
 
        setDividerDrawable(a.getDrawable(/*com.android.internal.R.styleable.*/LinearLayout_divider));
        mShowDividers = a.getInt(/*com.android.internal.R.styleable.*/LinearLayout_showDividers, SHOW_DIVIDER_NONE);
        mDividerPadding = a.getDimensionPixelSize(/*com.android.internal.R.styleable.*/LinearLayout_dividerPadding, 0);
        mUseLargestChild = a.getBoolean(/*com.android.internal.R.styleable.*/LinearLayout_measureWithLargestChild, false);
 
        a.recycle();
    } 
 
    /** 
     * Set how dividers should be shown between items in this layout 
     * 
     * @param showDividers One or more of {@link #SHOW_DIVIDER_BEGINNING}, 
     *                     {@link #SHOW_DIVIDER_MIDDLE}, or {@link #SHOW_DIVIDER_END}, 
     *                     or {@link #SHOW_DIVIDER_NONE} to show no dividers. 
     */ 
7
CodeRank
This code example shows how to use the following methods:getDimensionPixelSize, peekValue
    public static float getFraction(final TypedArray a, final int index) {
        return getFraction(a, index, UNDEFINED_RATIO);
    } 
 
    public static int getDimensionPixelSize(final TypedArray a, final int index) {
        final TypedValue value = a.peekValue(index);
        if (value == null || !isDimensionValue(value)) {
            return ResourceUtils.UNDEFINED_DIMENSION;
        } 
        return a.getDimensionPixelSize(index, ResourceUtils.UNDEFINED_DIMENSION);
    } 
 
    public static float getDimensionOrFraction(final TypedArray a, final int index, final int base,
            final float defValue) {
        final TypedValue value = a.peekValue(index);
        if (value == null) {
            return defValue;
        } 
        if (isFractionValue(value)) {
            return a.getFraction(index, base, base, defValue);
6
CodeRank
This code example shows how to use the following methods:getDimensionPixelSize, recycle
 
    } 
 
    public static int getActionBarHeight() { 
        TypedArray a = context.obtainStyledAttributes(new int[]{ACTIONBAR_HEIGHT});
        int ret = a.getDimensionPixelSize(0, -1);
        a.recycle();
        return ret;
    } 
 
    public static boolean isFollowSystemBackground() { 
        return followSystemBackground;
    } 
 
    public static void setFollowSystemBackground(boolean isFollowSystemBackground) {
        followSystemBackground = isFollowSystemBackground;
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getDimensionPixelSize, getDrawable, getInteger, recycle
This code example shows how to use the following methods:getDimensionPixelSize, getDrawable, getInteger, recycle
This code example shows how to use the following methods:getDimensionPixelSize, recycle
    } 
 
    private void init(Context context, AttributeSet attributeset)
    { 
        TypedArray typedarray = context.obtainStyledAttributes(attributeset, attrsArray);
        mHorizontalSpacing = typedarray.getDimensionPixelSize(0, 0);
        mVerticalSpacing = typedarray.getDimensionPixelSize(1, 0);
        typedarray.recycle();
    } 
 
    protected void onMeasure(int i, int j)
    { 
        Resources resources = getContext().getResources();
        int k = android.view.View.MeasureSpec.getSize(i);
        int l = resources.getDimensionPixelSize(R.dimen.medium_avatar_dimension) + 2 * resources.getDimensionPixelSize(R.dimen.medium_avatar_selected_padding);
        int i1 = (k + mHorizontalSpacing) / (l + mHorizontalSpacing);
        int j1 = i1 * (l + mHorizontalSpacing) - mHorizontalSpacing;
        if(i1 > 0 && getLayoutParams().height == -2)
        { 
            int k1 = getCount();
5
CodeRank
This code example shows how to use the following methods:getDimensionPixelSize, getDrawable, recycle
 
    public IcsLinearLayout(Context context, int themeAttr) {
        super(context);
 
        TypedArray a = context.obtainStyledAttributes(null, LL, themeAttr, 0);
        setDividerDrawable(a.getDrawable(IcsLinearLayout.LL_DIVIDER));
        mDividerPadding = a.getDimensionPixelSize(LL_DIVIDER_PADDING, 0);
//        mShowDividers = a.getInteger(LL_SHOW_DIVIDER, SHOW_DIVIDER_NONE); 
        a.recycle();
    } 
 
    public void setDividerDrawable(Drawable divider) {
        if (divider == mDivider) {
            return; 
        } 
        mDivider = divider;
        if (divider != null) {
            mDividerWidth = divider.getIntrinsicWidth();
            mDividerHeight = divider.getIntrinsicHeight();
        } else { 
5
CodeRank

Related TypedArray getDimensionPixelSize Questions & Answers:

getDimensionPixelSize Method Overview
Retrieve a dimensional unit attribute at index for use as a size in raw pixels.
See Code Examples for other Android TypedArray Methods: