android - Color gradient for textcolor -
i have textview. want change color of text gradient it's not work
<shape android:shape="rectangle" > <gradient android:angle="90" android:startcolor="#eabd00" android:centercolor="#fef1b2" android:endcolor="#f9e273" android:type="linear" /> </shape>
can me? all.
try this
textview textview = findviewbyid(r.id.btnlogin) shader textshader=new lineargradient(0, 0, 0, 20, new int[]{r.color.coloraccent,r.color.colorprimary}, new float[]{0, 1}, tilemode.clamp); textview.getpaint().setshader(textshader);
or this
textview txt1 = (textview) findviewbyid(r.id.textview); int[] color = {color.dkgray,color.cyan}; float[] position = {0, 1}; tilemode tile_mode = tilemode.mirror; // or tilemode.repeat; lineargradient lin_grad = new lineargradient(0, 0, 0, 50,color,position, tile_mode); shader shader_gradient = lin_grad; txt1.getpaint().setshader(shader_gradient);
Comments
Post a Comment