1在xml中使用RichTex 不管是单独使用 或者xml布局中的一个控件 一定要被 ScrollView 包着使用
不然显示出问题
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/tv_rich" android:layout_width="match_parent" android:layout_height="match_parent" /> </ScrollView>
RichText.fromHtml(contents)
.clickable(true)
.imageClick(new OnImageClickListener() {
@Override
public void imageClicked(List<String> imageUrls, int position) {
//TODO 图片放大
List<ImageInfo> imageInfosList = new ArrayList<>();
for (int i = 0; i < imageUrls.size(); i++) {
ImageInfo imageInfo = new ImageInfo(imageUrls.get(i), 200, 200);
imageInfosList.add(imageInfo);
}
if (imageInfosList == null || imageInfosList.isEmpty()) return;
PicShowDialog dialog = new PicShowDialog(LaiShowWebViewActivity.this, imageInfosList, position);
dialog.show();
}
}).into(findViewById(R.id.tv_rich));