Underlined TextView text in Android

Advertisement

I’ve been developing Android Apps a week now, like you I’m a beginner in this field too and just started to broaden my mind in app development, to save me time digging the net I’ve decided to add new interested post snippet here instead, this help me time digging the web and find what I need, so for now I’m done adding DBTools or DB Class and I’d like to share my code too, in this post I just wanted to share a bit of idea in designing or simply adding underline in TextView text.

Lets get started

Code


// in here I've added underline in lblNewAccount TextView ID
TextView textView = (TextView) findViewById(R.id.lblNewAccount);
textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

Another Way

Another way is by simply adding u tag in strings.xml file, at the moment it only allow 3 tags, italic, bold and underline.

Happy coding ^-^

Advertisement