Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wangshaolei/AutoSpannableTextView

Support some of the key words can be clicked with the underline TextView
https://github.com/wangshaolei/AutoSpannableTextView

Last synced: 3 months ago
JSON representation

Support some of the key words can be clicked with the underline TextView

Awesome Lists containing this project

README

        

# AutoSpannableTextView
Support some of the key words can be clicked with the underline TextView

Step1:

```xml

//key word with color and underline, and split with ','(en)
//word and underline's color
//underline with true and false
//start with image 's TextView


//default


```

Step2:

```xml
//style1

//style2

```
Step3:

```java

//style1
autoLinkStyleTextView.setOnClickCallBack(new AutoLinkStyleTextView.ClickCallBack() {
@Override
public void onClick(int position) {
if (position == 0) {
Toast.makeText(MainActivity.this, "购买须知", Toast.LENGTH_SHORT).show();
} else if (position == 1) {
Toast.makeText(MainActivity.this, "用户条款", Toast.LENGTH_SHORT).show();
}
}
});

//style2
setStartImageText(tvStartImage.getText());
```

![](https://github.com/wangshaolei/UnderLineLinkTextView/blob/master/img/1.png)
![](https://github.com/wangshaolei/UnderLineLinkTextView/blob/master/img/2.png)
![](https://github.com/wangshaolei/UnderLineLinkTextView/blob/master/img/3.png)