I made this Icon in Photoshop, but now I want to make the gradiant in Android and use it as the Textcolor
for a Textview
The colors and settings from Photoshop is:
Style: Linear
Angle: 90*
Colors: #00a8d9 (0%), #223595 (20%), #f1328f(40%), #ee3031(60%), #f9e63a(80%), #009958(100%)
The numbers in the parentes is the location value.
I have tried the following, but its only showing one color
LinearGradient linearGradient = new LinearGradient(20,30,40,50, new int[] {Color.parseColor("#00a8d9"), Color.parseColor("#223595"), Color.parseColor("#f1328f"), Color.parseColor("#ee3031"), Color.parseColor("#f9e63a"), Color.parseColor("#009958")},new float[]{0,0,0,0,0,0},
Shader.TileMode.REPEAT);
textView.getPaint().setShader(linearGradient);
2
Answers
You may Try this.
Try to set this as your view background colour and set colour as per your need.
I managed to replicate the gradient from the picture to the code with this solution:
Another problem is that the gradient dosn’t look the same with different screen sizes. This will be in a another question