Skip to content

Commit 08c963d

Browse files
author
hzwangchenyan
committed
Update README.md
1 parent 2249848 commit 08c963d

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ HtmlText 是 android.text.Html 的一个扩展,可以加载 HTML 并将其转
3131
- `<font color="..." face="...">`
3232
- `<h1>`, `<h2>`, `<h3>`, `<h4>`, `<h5>`, `<h6>`
3333
- `<a href="...">`
34-
- `<img src="...">`
34+
- `< img src="...">`
3535

3636
### Extended support by HtmlText
3737

@@ -43,7 +43,7 @@ HtmlText 是 android.text.Html 的一个扩展,可以加载 HTML 并将其转
4343
- `<strike>`
4444
- `<div>`[HTML contains two newline, there is one]
4545
- `<font size="..." color="...">`[extend support size]
46-
- `<img src="..." width="..." height="...">`[extend support width, height]
46+
- `< img src="..." width="..." height="...">`[extend support width, height]
4747

4848
## Sample
4949

@@ -58,7 +58,7 @@ HtmlText.from(sample)
5858
@Override
5959
public void loadImage(String url, final Callback callback) {
6060
// Glide sample, you can also use other image loader
61-
Glide.with(MainActivity.this)
61+
Glide.with(context)
6262
.load(url)
6363
.asBitmap()
6464
.into(new SimpleTarget<Bitmap>() {
@@ -77,12 +77,12 @@ HtmlText.from(sample)
7777
7878
@Override
7979
public Drawable getDefaultDrawable() {
80-
return ContextCompat.getDrawable(MainActivity.this, R.drawable.image_placeholder_loading);
80+
return ContextCompat.getDrawable(context, R.drawable.image_placeholder_loading);
8181
}
8282
8383
@Override
8484
public Drawable getErrorDrawable() {
85-
return ContextCompat.getDrawable(MainActivity.this, R.drawable.image_placeholder_fail);
85+
return ContextCompat.getDrawable(context, R.drawable.image_placeholder_fail);
8686
}
8787
8888
@Override
@@ -97,18 +97,22 @@ HtmlText.from(sample)
9797
})
9898
.setOnTagClickListener(new OnTagClickListener() {
9999
@Override
100-
public void onImageClick(List<String> imageUrlList, int position) {
100+
public void onImageClick(Context context, List<String> imageUrlList, int position) {
101101
// image click
102102
}
103103
104104
@Override
105-
public void onLinkClick(String url) {
105+
public void onLinkClick(Context context, String url) {
106106
// link click
107107
}
108108
})
109109
.into(textView);
110110
```
111111

112+
## Download
113+
114+
Github: [HtmlText](https://github.com/wangchenyan/HtmlText)
115+
112116
## Thanks
113117

114118
- [html-textview](https://github.com/SufficientlySecure/html-textview)

0 commit comments

Comments
 (0)