当前位置: 首页>>代码示例>>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;未经允许,请勿转载。