Issue
I am trying to change color of my snackbar
snackbarView.setBackgroundColor(ContextCompat.getColor(context, Color.RED));
I am getting something like this :
android.content.res.Resources$NotFoundException: Resource ID #0xffff0000
Where definitely
0xffff0000
represents RED.But why it cant find this resource? Any help?
Solution
Try this :-
In your values.xml , create colors.xml and add following line :
<color name="red">#FF0000</color>
Then call this color like this :-
snackbarView.setBackgroundColor(ContextCompat.getColor(context,R.color.red));
Answered By - Rajshree Tiwari
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.