Learn Python


Click to Learn Python3

Monday, February 28, 2011

How to underline a textview in android

We can underline the Textview in android through this codings


Java

SpannableString contentUnderline = new SpannableString("http://www.android-codes-examples.com");
contentUnderline.setSpan(new UnderlineSpan(), 0, contentUnderline.length(), 0);
TextView mPage = (TextView) findViewById(R.id.page);
mPage.setText(contentUnderline);


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.

No comments:

Post a Comment