當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。