Android
안드로이드 TextView Html
Gibson 김형섭
2016. 7. 13. 14:54
# android textview html (underline, color) 부분스타일 바꾸기
안드로이드 개발을 하다보면 textview에 setText해줄 때 특정문장만
색상을 변경하거나 밑줄표시를 해줘야 할 때가 있다.
android에서 html클래스를 지원해주기 때문에 html문법을 이용하면 된다.
String text = "안녕하세요";
textView.setText(Html.fromHtml("<u>" + text + "</u>"));
underLine
textView.setText(Html.fromHtml("<font color=\"#FFFFFF\">" + text + " </font>"));
color
textView.setText(Html.fromHtml("테스트 " + "<font color=\"#2a7de2\"><u>파란색</u></font>" + "입니다 "));
underLine + color