0

just like a yellow highlighter pen. How can I draw a thin yellow line on the TextView text with round corner at both ends ?

thank you

DayDayHappy
  • 1,679
  • 1
  • 15
  • 26
  • 2
    Duplicate http://stackoverflow.com/questions/3496269/how-to-put-a-border-around-an-android-textview – Robin Chander Nov 13 '12 at 16:06
  • Look at: http://stackoverflow.com/questions/3496269/how-to-put-a-border-around-an-android-textview – Paul Lich Nov 13 '12 at 16:14
  • Are you asking about highlighting individual words or phrases? (Three people have already suggested the same link for adding a border...) – Sam Nov 14 '12 at 01:53

1 Answers1

0

You can use gradient and control it as you wish as follow :

 <?xml version="1.0" encoding="utf-8"?>
  <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
   <gradient android:startColor="#FFFF00" android:centerColor="#FFFF00"
         android:endColor="#FFFF00" android:angle="0" /> 
     <corners android:radius="30dp"  /> 
 </shape>

and in xml refer textview to that gradient as follow :

   android:background="@drawable/gredient"  

hope help you.

frozenhill
  • 124
  • 1
  • 9
  • thanks for your help. I initially used this but this is not what I expect because when the text in the TextView spans across several row, it is just a big round rectangle. What I want is highlighting pen over the middle of text. thanks anyway – DayDayHappy Nov 14 '12 at 14:29
  • @DayDayHappy i think if you add gradiant programmatically you can control its position – frozenhill Nov 14 '12 at 15:23