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


Java DrawableCompat.inflate方法代码示例

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


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

示例1: inflate

import android.support.v4.graphics.drawable.DrawableCompat; //导入方法依赖的package包/类
public void inflate(Resources res, XmlPullParser parser, AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException {
    if (this.mDelegateDrawable != null) {
        DrawableCompat.inflate(this.mDelegateDrawable, res, parser, attrs, theme);
        return;
    }
    VectorDrawableCompatState state = this.mVectorState;
    state.mVPathRenderer = new VPathRenderer();
    TypedArray a = VectorDrawableCommon.obtainAttributes(res, theme, attrs, AndroidResources.styleable_VectorDrawableTypeArray);
    updateStateFromTypedArray(a, parser);
    a.recycle();
    state.mChangingConfigurations = getChangingConfigurations();
    state.mCacheDirty = true;
    inflateInternal(res, parser, attrs, theme);
    this.mTintFilter = updateTintFilter(this.mTintFilter, state.mTint, state.mTintMode);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:16,代码来源:VectorDrawableCompat.java

示例2: inflate

import android.support.v4.graphics.drawable.DrawableCompat; //导入方法依赖的package包/类
public void inflate(Resources res, XmlPullParser parser, AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException {
    if (this.mDelegateDrawable != null) {
        DrawableCompat.inflate(this.mDelegateDrawable, res, parser, attrs, theme);
        return;
    }
    int eventType = parser.getEventType();
    while (eventType != 1) {
        if (eventType == 2) {
            String tagName = parser.getName();
            TypedArray a;
            if (ANIMATED_VECTOR.equals(tagName)) {
                a = obtainAttributes(res, theme, attrs, AndroidResources.styleable_AnimatedVectorDrawable);
                int drawableRes = a.getResourceId(0, 0);
                if (drawableRes != 0) {
                    VectorDrawableCompat vectorDrawable = VectorDrawableCompat.create(res, drawableRes, theme);
                    vectorDrawable.setAllowCaching(false);
                    vectorDrawable.setCallback(this.mCallback);
                    if (this.mAnimatedVectorState.mVectorDrawable != null) {
                        this.mAnimatedVectorState.mVectorDrawable.setCallback(null);
                    }
                    this.mAnimatedVectorState.mVectorDrawable = vectorDrawable;
                }
                a.recycle();
            } else if (TARGET.equals(tagName)) {
                a = res.obtainAttributes(attrs, AndroidResources.styleable_AnimatedVectorDrawableTarget);
                String target = a.getString(0);
                int id = a.getResourceId(1, 0);
                if (id != 0) {
                    if (this.mContext != null) {
                        setupAnimatorsForTarget(target, AnimatorInflater.loadAnimator(this.mContext, id));
                    } else {
                        throw new IllegalStateException("Context can't be null when inflating animators");
                    }
                }
                a.recycle();
            } else {
                continue;
            }
        }
        eventType = parser.next();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:43,代码来源:AnimatedVectorDrawableCompat.java


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