TextView Gradient Color

 TextView Gradient Color


Put this code in your activity to change your TextView color into gradient.

Codes:
textview = (TextView) findViewById(R.id.textview1);

        TextPaint paint = textview.getPaint();
        float width = paint.measureText("Put your text here");

        Shader textShader = new LinearGradient(0, 0, width, textview.getTextSize(),
                new int[]{
                        Color.parseColor("#C97C3C"),
                        Color.parseColor("#EDB54E"),
                        Color.parseColor("#A4B678"),
                        Color.parseColor("#4788EA"),
                        Color.parseColor("#9846CC"),
                }, null, Shader.TileMode.CLAMP);
        textview.getPaint().setShader(textShader);

textview7 - TextView ID

Comments

Popular posts from this blog

Number with Comma (9,999)

Get X, Y Position of Layout

Status Bar Text Visibility