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

Asked 1 years ago, Updated 1 years ago, 90 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.