本文整理匯總了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();
}
}