Reputation: 115
<string-array name="myarray">
<item>Apple</item>
<item>Banana</item>
<item>Grape</item>
<item>Melon</item>
if i want to add Underline the "Banana" what should I add?
Upvotes: 8
Views: 18000
Reputation: 42016
use SpannableString
by which you can do Underline, Strike, Highlight, Bold, Italic etc to the text
for Underline you have to use UnderlineSpan
http://developer.android.com/reference/android/text/style/UnderlineSpan.html
TextView textview = (TextView)findViewById(R.id.textview);
SpannableString content = new SpannableString("Apple Banana Grape Melon");
content.setSpan(new UnderlineSpan(), 6, 11, 0);
textview.setText(content);
or simply by adding HTML tag to the resource string <string name="sample"> <u>your data</u></string>
Upvotes: 20
Reputation: 5561
<resource>
<string name="your_string_here">This is an <u>underline</u>.</string>
</resources>
Upvotes: 3