getColor(int) 已弃用 我如何使用 getColor(int,theme theme)

getColor(int) is deprecated how i can use getColor(int,theme theme)

getColor(int) 已弃用。

如何使用getColor(int, theme theme)

我使用了一些课程,但找不到如何使用 getColor(int, theme theme)

将某物用作

    ResourcesCompat.getColor(getResources(), R.color.red, null)

(API 23 级之前不会应用主题,所以可能是 null。)