是的,Android中的getColor方法可以读取主题颜色。可以通过在代码中使用ContextCompat.getColor方法并传入主题颜色的资源ID来获取主题颜色。例如:
int themeColor = ContextCompat.getColor(getContext(), R.attr.colorPrimary);
这样就可以获取到当前主题中定义的colorPrimary颜色。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:如何通过Android getColor优化UI体验