/**
* Resolves the reference to an attribute, returning the root resource id.
*
* @param context The context to use when determining the root id
* @param attr The attribute to resolve
* @return The resource id pointing to the de-referenced attribute
*/
@AnyRes
public static int getResolvedResourceId(Context context, @AttrRes int attr) {
TypedValue typedValue = new TypedValue();
Resources.Theme theme = context.getTheme();
theme.resolveAttribute(attr, typedValue, true);
if (typedValue.type == TypedValue.TYPE_REFERENCE) {
return typedValue.data;
}
return typedValue.resourceId;
}
ResourceUtil.java 文件源码
java
阅读 38
收藏 0
点赞 0
评论 0
项目:ExoMedia
作者:
评论列表
文章目录