是的,Android中的getColor方法可以讀取主題顏色??梢酝ㄟ^在代碼中使用ContextCompat.getColor方法并傳入主題顏色的資源ID來獲取主題顏色。例如:
int themeColor = ContextCompat.getColor(getContext(), R.attr.colorPrimary);
這樣就可以獲取到當前主題中定義的colorPrimary顏色。