Showing posts with label Set gradient style with text shader in android.. Show all posts
Showing posts with label Set gradient style with text shader in android.. Show all posts

Wednesday 31 March 2021

Android Text Shader with Gradient Style

 How to set textview gradient color in android , below image is  showing the text with gradient style , this style is apply with 2 colors and Text Shader method.




So , lets start to learn how to do the textview gradient color.


txtshader1.getPaint().setShader(SetTextShader_Gradient1(mContext));

Shader textShader=new LinearGradient(0, 0, 0, 60,
new int[]{mContext.getColor(R.color.text_gradiet_1),mContext.getColor(R.color.text_gradiet_2)},
new float[]{0, 1}, Shader.TileMode.CLAMP);


This is the how Textview work with colors using Text Shader.
Here is the code for this doing Textview with gradient style.





Find Hours Diffrence in Kotlin

  In Kotlin, determining the difference in hours between two timestamps is a common task, especially in scenarios involving time-based calcu...