2016-11-25 16 views
0

getColor(int)은 더 이상 사용되지 않습니다.getColor (int)는 더 이상 사용되지 않습니다. getColor (int, theme theme)를 사용하는 방법

어떻게 getColor(int, theme theme)을 사용할 수 있습니까?

나는 몇 가지 교훈을 사용하여 어떻게 사용할 수 있는지 찾을 수 없다. getColor(int, theme theme).

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

(API 레벨 23을 테마로 이전이이 null 할 수 있도록 적용되지 않습니다.)

+0

당신이 자원 봤어? https://developer.android.com/reference/android/content/res/Resources.html#getColor(int, android.content.res.Resources.Theme) –

답변

2

사용 뭔가

+0

대신에'context.getTheme()'를 사용하는 것이 좋습니다. 'null'이거나 사용하지 않는 메소드를 사용할 수도 있습니다. –