When I need to underline text in an app that I’m developing, I like doing it programmatically. The code is in the Java file, not in the XML. Maybe we should make a function for this where we pass the ID of the TextView whose content we’d like to underline.
1 2 3 |
TextView myTextView = (TextView) findViewById(R.id.myTextViewID); String htmlString = "<u>" + myTextView.getText() + "</u>"; myTextView.setText(Html.fromHtml(htmlString)); |
Disadvantages in this method: […]