Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/wangshaolei/AutoSpannableTextView
- Owner: wangshaolei
- Created: 2016-10-10T09:22:40.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-22T02:50:09.000Z (about 7 years ago)
- Last Synced: 2024-05-22T06:12:31.903Z (6 months ago)
- Language: Java
- Homepage:
- Size: 138 KB
- Stars: 368
- Watchers: 7
- Forks: 50
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-android-ui - UnderLineLinkTextView - 使关键词带有可点击的下划线TextView (TextView)
README
# AutoSpannableTextView
Support some of the key words can be clicked with the underline TextViewStep1:
```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)