Android Project

Android Project
Android Project

Monday, February 28, 2011

How to underline a textview in android

We can underline the Textview in android through this codings


SpannableString contentUnderline = new SpannableString("");
contentUnderline.setSpan(new UnderlineSpan(), 0, contentUnderline.length(), 0);
TextView mPage = (TextView) findViewById(;

Through the SpannableString we can underline the text, it can be static or dynamic text no problem, first we have to set the string to the SpannableString and then we need to setSpan, and then we need to set that variable to the TextView.

1 comment: