Issue
I am trying to color my toolbar and status bar with two colors I have defined in the colors.xml file.
((AppCompatActivity) getActivity())
.getSupportActionBar()
.setBackgroundDrawable(?);
window.setStatusBarColor(?);
What should be put inside the brackets in order to refer to R.color.a
and R.color.b
?
Solution
Pass RGB value of the color
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.rgb(248, 248, 248)));
To pass Resourse id
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(getContext(),R.color.primary)));
Answered By - randy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.