Android color Configurator
If you want to set the color, you can directly set the background property or other color properties. Set any color, such as #000, and then click the color box on the left to pop up the color selector to select the color
①Color.parseColor("#000");
tvShow.setBackgroundColor(Color.parseColor("#000"));
[prompt] you can configure the color value in the layout file, and then bring the color represented by "#" to the Java code
② Color. Black uses the colors of the color class, but they are all basic colors
tvShow.setBackgroundColor(Color.BLACK);
③ Define the color resource file, which is referenced by r.color.mycolor
int color = R.color.myColor;
tvShow.setBackgroundResource(R.color.myColor);
④ Color. ARGB (a, R, G, b) method:
tvShow.setBackgroundColor(Color.argb(255,0));
They are alpha, red, green and blue color values (ARGB). Each number is 0-255, so a color can be represented by an integer. In order to run efficiently, an integer color class instance is used to represent the color when encoding Android.
[prompt] pass in the corresponding transparency value, red value, green value and blue value to configure the color. Therefore, we can make a simple color configurator through this method.
The interface design is rough. I hope you can learn the implementation effect and optimize the interface.
[prompt] hint attribute in EditText: This is the prompt text in the setting input box. Inputtype property: sets the text type entered in the input box. It is set as integer here