本文整理汇总了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);
}
示例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();
}
}