@@ -31,7 +31,7 @@ HtmlText 是 android.text.Html 的一个扩展,可以加载 HTML 并将其转
31
31
- ` <font color="..." face="..."> `
32
32
- ` <h1> ` , ` <h2> ` , ` <h3> ` , ` <h4> ` , ` <h5> ` , ` <h6> `
33
33
- ` <a href="..."> `
34
- - ` <img src="..."> `
34
+ - ` < img src="..."> `
35
35
36
36
### Extended support by HtmlText
37
37
@@ -43,7 +43,7 @@ HtmlText 是 android.text.Html 的一个扩展,可以加载 HTML 并将其转
43
43
- ` <strike> `
44
44
- ` <div> ` [ HTML contains two newline, there is one]
45
45
- ` <font size="..." color="..."> ` [ extend support size]
46
- - ` <img src="..." width="..." height="..."> ` [ extend support width, height]
46
+ - ` < img src="..." width="..." height="..."> ` [ extend support width, height]
47
47
48
48
## Sample
49
49
@@ -58,7 +58,7 @@ HtmlText.from(sample)
58
58
@Override
59
59
public void loadImage(String url, final Callback callback) {
60
60
// Glide sample, you can also use other image loader
61
- Glide.with(MainActivity.this )
61
+ Glide.with(context )
62
62
.load(url)
63
63
.asBitmap()
64
64
.into(new SimpleTarget<Bitmap>() {
@@ -77,12 +77,12 @@ HtmlText.from(sample)
77
77
78
78
@Override
79
79
public Drawable getDefaultDrawable() {
80
- return ContextCompat.getDrawable(MainActivity.this , R.drawable.image_placeholder_loading);
80
+ return ContextCompat.getDrawable(context , R.drawable.image_placeholder_loading);
81
81
}
82
82
83
83
@Override
84
84
public Drawable getErrorDrawable() {
85
- return ContextCompat.getDrawable(MainActivity.this , R.drawable.image_placeholder_fail);
85
+ return ContextCompat.getDrawable(context , R.drawable.image_placeholder_fail);
86
86
}
87
87
88
88
@Override
@@ -97,18 +97,22 @@ HtmlText.from(sample)
97
97
})
98
98
.setOnTagClickListener(new OnTagClickListener() {
99
99
@Override
100
- public void onImageClick(List<String> imageUrlList, int position) {
100
+ public void onImageClick(Context context, List<String> imageUrlList, int position) {
101
101
// image click
102
102
}
103
103
104
104
@Override
105
- public void onLinkClick(String url) {
105
+ public void onLinkClick(Context context, String url) {
106
106
// link click
107
107
}
108
108
})
109
109
.into(textView);
110
110
```
111
111
112
+ ## Download
113
+
114
+ Github: [ HtmlText] ( https://github.com/wangchenyan/HtmlText )
115
+
112
116
## Thanks
113
117
114
118
- [ html-textview] ( https://github.com/SufficientlySecure/html-textview )
0 commit comments