當前位置: 首頁>>代碼示例>>Java>>正文


Java Drawable.setChangingConfigurations方法代碼示例

本文整理匯總了Java中android.graphics.drawable.Drawable.setChangingConfigurations方法的典型用法代碼示例。如果您正苦於以下問題:Java Drawable.setChangingConfigurations方法的具體用法?Java Drawable.setChangingConfigurations怎麽用?Java Drawable.setChangingConfigurations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.drawable.Drawable的用法示例。


在下文中一共展示了Drawable.setChangingConfigurations方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: copyProperties

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
/**
 * Copies various properties from one drawable to the other.
 * @param to drawable to copy properties to
 * @param from drawable to copy properties from
 */
public static void copyProperties(Drawable to, Drawable from) {
  if (from == null || to == null || to == from) {
    return;
  }

  to.setBounds(from.getBounds());
  to.setChangingConfigurations(from.getChangingConfigurations());
  to.setLevel(from.getLevel());
  to.setVisible(from.isVisible(), /* restart */ false);
  to.setState(from.getState());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:DrawableUtils.java

示例2: loadDrawableFromDelegates

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
private Drawable loadDrawableFromDelegates(@NonNull Context context, @DrawableRes int resId) {
    if (this.mDelegates == null || this.mDelegates.isEmpty()) {
        return null;
    }
    if (this.mKnownDrawableIdTags != null) {
        String cachedTagName = (String) this.mKnownDrawableIdTags.get(resId);
        if (SKIP_DRAWABLE_TAG.equals(cachedTagName) || (cachedTagName != null && this.mDelegates.get(cachedTagName) == null)) {
            return null;
        }
    }
    this.mKnownDrawableIdTags = new SparseArray();
    if (this.mTypedValue == null) {
        this.mTypedValue = new TypedValue();
    }
    TypedValue tv = this.mTypedValue;
    Resources res = context.getResources();
    res.getValue(resId, tv, true);
    long key = (((long) tv.assetCookie) << 32) | ((long) tv.data);
    Drawable dr = getCachedDelegateDrawable(context, key);
    if (dr != null) {
        return dr;
    }
    if (tv.string != null && tv.string.toString().endsWith(".xml")) {
        try {
            int type;
            XmlPullParser parser = res.getXml(resId);
            AttributeSet attrs = Xml.asAttributeSet(parser);
            do {
                type = parser.next();
                if (type == 2) {
                    break;
                }
            } while (type != 1);
            if (type != 2) {
                throw new XmlPullParserException("No start tag found");
            }
            String tagName = parser.getName();
            this.mKnownDrawableIdTags.append(resId, tagName);
            InflateDelegate delegate = (InflateDelegate) this.mDelegates.get(tagName);
            if (delegate != null) {
                dr = delegate.createFromXmlInner(context, parser, attrs, context.getTheme());
            }
            if (dr != null) {
                dr.setChangingConfigurations(tv.changingConfigurations);
                if (addCachedDelegateDrawable(context, key, dr)) {
                }
            }
        } catch (Exception e) {
            Log.e(TAG, "Exception while inflating drawable", e);
        }
    }
    if (dr != null) {
        return dr;
    }
    this.mKnownDrawableIdTags.append(resId, SKIP_DRAWABLE_TAG);
    return dr;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:58,代碼來源:AppCompatDrawableManager.java


注:本文中的android.graphics.drawable.Drawable.setChangingConfigurations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。