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


Java TypedArray.getPositionDescription方法代碼示例

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


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

示例1: init

import android.content.res.TypedArray; //導入方法依賴的package包/類
/**
 * 獲取需要繪製的這些圖片
 */
private void init(Context context, AttributeSet attrs, int defStyle) {
    TypedArray type = context.obtainStyledAttributes(attrs, R.styleable.ShadeTriangleView, 0, 0);
    mImageMaskSource = type.getResourceId(R.styleable.ShadeTriangleView_mask_image, R.drawable.mask_triangle);
    mImageSource_one = type.getResourceId(R.styleable.ShadeTriangleView_image_left, R.drawable.mask_source_left);
    mImageSource_two = type.getResourceId(R.styleable.ShadeTriangleView_image_right, R.drawable.mask_source_right);
    type.recycle();

    if (mImageMaskSource == 0 || mImageSource_one == 0 || mImageSource_two == 0) {
        mException = new IllegalArgumentException(type.getPositionDescription() +
                ": 遮罩動畫View-->>The content attribute is required and must refer to a valid image.");
    }

    if (mException != null)
        throw mException;

    mMask_bitmap = readBitMap(context, mImageMaskSource);
    mSource_one_bitmap = readBitMap(context, mImageSource_one);
    mSource_two_bitmap = readBitMap(context, mImageSource_two);
    mPaint_Mask.setColor(Color.WHITE);
    mPaint_Mask.setStyle(Paint.Style.FILL);
    mPaint_Mask.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));

    path = new Path();

}
 
開發者ID:NickKJ,項目名稱:Mask-Animation,代碼行數:29,代碼來源:ShadeTriangleForRankView.java

示例2: init

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

        TypedArray viewAttrs = context.obtainStyledAttributes(attrs, R.styleable.SplitView);

        RuntimeException e = null;
        mHandleId = viewAttrs.getResourceId(R.styleable.SplitView_handle, 0);
        if (mHandleId == 0) {
            e = new IllegalArgumentException(viewAttrs.getPositionDescription() +
                    ": The required attribute handle must refer to a valid child view.");
        }

        mPrimaryContentId = viewAttrs.getResourceId(R.styleable.SplitView_topContent, 0);
        if (mPrimaryContentId == 0) {
            e = new IllegalArgumentException(viewAttrs.getPositionDescription() +
                    ": The required attribute primaryContent must refer to a valid child view.");
        }


        mSecondaryContentId = viewAttrs.getResourceId(R.styleable.SplitView_bottomContent, 0);
        if (mSecondaryContentId == 0) {
            e = new IllegalArgumentException(viewAttrs.getPositionDescription() +
                    ": The required attribute secondaryContent must refer to a valid child view.");
        }

        mMinSizePrimaryContent = viewAttrs.getDimension(R.styleable.SplitView_minSize, 1);
        viewAttrs.recycle();

        if (e != null) {
            throw e;
        }
    }
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:32,代碼來源:SplitView.java

示例3: 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


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