fun TypedArray.getCompatColor(theme:Resources.Theme,@StyleableRes index: Int, typedValue: TypedValue): Int? {
if (getValue(index, typedValue)) {
if (typedValue.type == TypedValue.TYPE_ATTRIBUTE) {
theme.resolveAttribute(typedValue.data, typedValue, true)
return typedValue.data
} else {
return typedValue.data
}
} else if (theme.resolveAttribute(typedValue.data, typedValue, true)) {
return typedValue.data
}
return null
}
网友评论