Android Studio IDE has introduced a new color picker tool in its XML editor. It provides the easiest way to pick or change color for a XML view. It also shows existing color resources in the project and most importantly it avoids switching between files during development.
If you have added color value to your XML views, then you can see a color picker thumbnail with a preview near to each color references. See the below screenshot,
When you click on this thumbnail, it will open up a dialog with 2 tabs. First tab contains existing color resources and the second tab shows a custom color picker tool.
For adding a custom color, we have to use this color picker tool. So please switch to the second tab as shown in the below screenshot,
In the custom tab, you have GUI option and manual entry options for picking a custom color. GUI option includes a slider and palette tool. You can use any of them.
If you know the hex decimal code of the color, then enter that hex color code directly into the text box, Hex. See the below screen shot.
Or if you want to choose a color using GUI, then just click on the color picker interface. See the above screenshot.
There is an option for applying transparency to the selected color. See the below screenshot,
In this screenshot, i have added 62% transparency to the selected color.
If you know ARGB values of your custom color then, there is an option for providing a color as ARGB values too. The 4 input boxes shown below the slider tool will give you an option to enter the ARGB values of the color.
After you make changes, the selection will automatically update the XML code for color reference. i.e, no need to search for save button.
That’ts it. Now you can save the file and run to see the change in the application.