C.E/Java
[android] Textview에 링크 넣기(달기) (android textview link)
숨[Breath]
2019. 3. 15. 09:10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tvLinkify = (TextView) findViewById(R.id.tvLinkify); String text = "구글 링크."; tvLinkify.setText(text); Linkify.TransformFilter mTransform = new Linkify.TransformFilter() { @Override public String transformUrl(Matcher match, String url) { return ""; } }; Pattern patterm = Pattern.compile("링크"); Linkify.addLinks(tvLinkify, pattern1, "http://www.google.co.kr",null,mTransform); } } | cs |