0

enter image description here

How to apply shadow as per above image? I used

android:ellipsize="none" 

for ellipsize of text from TextView.

Thanks in advance...

4
  • 4
    did you want stackoverflow.com/questions/2680607/… ? Commented Dec 29, 2014 at 8:35
  • I want as per attached image.. :( Commented Dec 29, 2014 at 8:36
  • open link and try code, you got same result Commented Dec 29, 2014 at 8:37
  • 3
    @nisha.113a5 That's called a gradient, not a shadow. Commented Dec 29, 2014 at 8:43

1 Answer 1

4

Try below code:

TextView txt = (TextView) findViewById(R.id.textView1); Shader textShader=new LinearGradient(0,0, 60, 20, new int[]{Color.WHITE,Color.TRANSPARENT}, new float[]{0, 1}, TileMode.CLAMP); txt.getPaint().setShader(textShader); 

I guess all you need to adjust (if required) is those values like 60,20 in above.

I am attaching the screenshot of the result, for reference.enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.