I want to set gradient text color in my TextView
. I have used this code for it
Shader textShader=new LinearGradient(0, 0, 0, 20, new int[]{Color.rgb(225, 225, 225),Color.rgb(150, 150, 150)}, new float[]{0, 1}, TileMode.CLAMP);
text.getPaint().setShader(textShader);
When activity is launched, the text is not shown. But if I change the orientation of my phone, then it will display the text in TextView
with gradient color. I have tested it on HTC One V. It is working fine on emulator and Samsung device.
I have also tested the following example, and the same problem occur .