Guest User

Untitled

a guest
Feb 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. private static void singleTextView(TextView textView, final String userName, String status, final String songName) {
  2.  
  3. SpannableStringBuilder spanText = new SpannableStringBuilder();
  4. spanText.append(userName);
  5. spanText.setSpan(new ClickableSpan() {
  6. @Override
  7. public void onClick(View widget) {
  8.  
  9. // On Click Action
  10.  
  11. }
  12.  
  13. @Override
  14. public void updateDrawState(TextPaint textPaint) {
  15. textPaint.setColor(textPaint.linkColor); // you can use custom color
  16. textPaint.setUnderlineText(false); // this remove the underline
  17. }
  18. }, spanText.length() - userName.length(), spanText.length(), 0);
  19.  
  20. spanText.append(status);
  21. spanText.append(songName);
  22. spanText.setSpan(new ClickableSpan() {
  23. @Override
  24. public void onClick(View widget) {
  25.  
  26. // On Click Action
  27.  
  28. }
  29.  
  30. @Override
  31. public void updateDrawState(TextPaint textPaint) {
  32. textPaint.setColor(textPaint.linkColor); // you can use custom color
  33. textPaint.setUnderlineText(false); // this remove the underline
  34. }
  35. },spanText.length() - songName.length(), spanText.length(), 0);
  36.  
  37. textView.setMovementMethod(LinkMovementMethod.getInstance());
  38. textView.setText(spanText, TextView.BufferType.SPANNABLE);
  39.  
  40. }
Add Comment
Please, Sign In to add comment