android_通过资源名_获取资源:
备忘:
private fun getDrawableIDByName(context: Context, name: String): Drawable? {
val res = context.resources
val img = context.resources.getIdentifier(name, "mipmap", context.packageName)
val drawable = try {
res.getDrawable(img, null)
} catch (e: Resources.NotFoundException) {
null
}
return drawable
}