-
-
Save codeforfun-jp/184dadaf7bb798c88bfbb7dd31200107 to your computer and use it in GitHub Desktop.
Kotlin - getColor method deprecated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val textView = findViewById<TextView>(R.id.textView); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | |
// API 23 以上 | |
textView.setTextColor(resources.getColor(R.color.black, theme)) | |
} else { | |
// API 23 未満 | |
textView.setTextColor(resources.getColor(R.color.white)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment