Is there a way to get the color value of int type from color resource?

Asked 2 years ago, Updated 2 years ago, 103 views

Is there a way to get the color value of int type from color resource?

android color

2022-09-21 18:57

1 Answers

In API23 and earlier, getResources().getColor(R.color.idname); You can do it like this.

In API23 and later versions, getResources().getColorStateList(id) ContextCompat.getColorStateList(getContext(),id); You can do it like this.


2022-09-21 18:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.