Android – how do I set the toolbar background color in the activity to the color in the colors.xml file?
•
Android
I have a color in my colors.xml file that I need to use for toolbar colors
<resources>
<color name="MAIN_A">#f16264</color>
</resources>
Now I need to use main_ A as the color of the toolbar
resolvent:
Use this code
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.white)));
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码