/**
* Tries to pull the Custom Attribute directly from the TextView.
*
* @param context Activity Context
* @param attrs View Attributes
* @param attributeId if -1 returns null.
* @return null if attribute is not defined or added to View
*/
@FontRes
static int pullFontPathFromView(Context context, AttributeSet attrs, int[] attributeId) {
if (attributeId == null || attrs == null)
return 0;
final String attributeName;
try {
attributeName = context.getResources().getResourceEntryName(attributeId[0]);
} catch (Resources.NotFoundException e) {
// invalid attribute ID
return 0;
}
final int stringResourceId = attrs.getAttributeResourceValue(null, attributeName, -1);
return stringResourceId > 0
? stringResourceId
: attrs.getAttributeIntValue(null, attributeName, 0);
}
CalligraphyUtils.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:DownloadableCalligraphy
作者:
评论列表
文章目录