2015년 10월 15일 목요일

Android TextView에서 웹 페이지로 링크(link) 거는 법





TextView txt = (TextView)findViewById(R.id.txt);

txt.setLinksClickable(true);
txt.setMovementMethod(LinkMovementMethod.getInstance());

String urlNaver = "<a href='http://www.naver.com'>네 이 버</a><br>";
String urlGoogle = "<a href='http://www.google.com'>구 글</a>";

txt.setText(Html.fromHtml(urlNaver));

txt.append(Html.fromHtml(urlGoogle));

댓글 없음:

댓글 쓰기