nuclearfog / Tagger

Twitter TextView highlighting for Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

  • highlight #hashtag and @username and make them clickable
  • customizable color

Project integration:

Code example:

String text = "#tag test @name test"
int redColor = 0xffff0000;

// Highlight text

Spannable span = Tagger.makeText(text, redColor);

textView1.setText(span);


// Highlight text and add Listener

Spannable spanClick = Tagger.makeText(text, redColor, new Tagger.OnTagClickListener() {
                @Override
                public void onClick(String tag) {
                  // called if hashtag or username is clicked
                }
                
                public void onLinkClick(String link) {
                  // called if url link is clicked
                }
            });
            
 textView2.setText(spanClick);

Logo by @Tobaloidee

About

Twitter TextView highlighting for Android

License:Apache License 2.0


Languages

Language:Java 100.0%