2020
12-10
12-10
解决Android自定义view获取attr中自定义颜色的问题
好久不见,最近有点忙,好久没有发文章了,前天有个小学弟在写项目的过程中遇到了这个问题,由此写一篇文章。项目场景:Android自定义View在布局中设置颜色问题描述:以下为学弟的代码//attrs文件<attrname="leftcolor"format="color"/><attrname="rightcolor"format="color"/>//Java文件代码,获取颜色intleftcolor=attrs.getAttributeIntValue("http://schemas.android.com/apk/res-auto","leftcolor",Color.BLACK);in...
继续阅读 >