Today you want to draw a curve that changes dynamically based on the color of the parameter, and the parameters are not fixed, so you need to get the color values based on the parameters. Studied for a long time and engaged in a scheme that was implemented through paint.
Paint contains a number of ways to set its properties, the main method is as follows:
Setantialias: Sets the brush's jagged effect.
setcolor: Setting Brush colors
Setargb: Sets the a,r,p,g value of the brush.
Setalpha: Setting alpha value
settextsize: Sets the font size.
SetStyle: Sets the brush style, hollow or solid.
setstrokewidth: Sets the hollow border width.
getColor: Get the color of the brush
Getalpha: Gets the alpha value of the brush.
All we need is SETARGB and getcolor.
private int GetColor (float yourparam) {int Alfa = 120;int Rcolor = 255;int Gcolor = 255;int Bcolor = 255;/********* * Your Code, change alfa/r/g/b by yourparam *********/paint paint = new Paint ();p Aint.setargb (Alfa, Rcolor, Gcolor, bcolor); Retu RN Paint.getcolor ();}
Set the color parameter in Android code