当前位置: 首页>>代码示例>>Java>>正文


Java Html.ImageGetter方法代码示例

本文整理汇总了Java中android.text.Html.ImageGetter方法的典型用法代码示例。如果您正苦于以下问题:Java Html.ImageGetter方法的具体用法?Java Html.ImageGetter怎么用?Java Html.ImageGetter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.text.Html的用法示例。


在下文中一共展示了Html.ImageGetter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setHtml

import android.text.Html; //导入方法依赖的package包/类
/**
 * Parses String containing HTML to Android's Spannable format and displays it in this TextView.
 * Using the implementation of Html.ImageGetter provided.
 *
 * @param html        String containing HTML, for example: "<b>Hello world!</b>"
 * @param imageGetter for fetching images. Possible ImageGetter provided by this library:
 *                    HtmlLocalImageGetter and HtmlRemoteImageGetter
 */
public void setHtml(@NonNull String html, @Nullable Html.ImageGetter imageGetter) {
    final HtmlTagHandler htmlTagHandler = new HtmlTagHandler(getPaint(), imageClick);
    htmlTagHandler.setClickableTableSpan(clickableTableSpan);
    htmlTagHandler.setDrawTableLinkSpan(drawTableLinkSpan);

    html = htmlTagHandler.overrideTags(html);

    if (removeFromHtmlSpace) {
        setText(removeHtmlBottomPadding(Html.fromHtml(html, imageGetter, htmlTagHandler)));
    } else {
        setText(Html.fromHtml(html, imageGetter, htmlTagHandler));
    }

    // make links work
    setMovementMethod(LocalLinkMovementMethod.getInstance());
}
 
开发者ID:RanKKI,项目名称:PSNine,代码行数:25,代码来源:HtmlTextView.java

示例2: setHtml

import android.text.Html; //导入方法依赖的package包/类
/**
 * Parses String containing HTML to Android's Spannable format and displays it in this TextView.
 * Using the implementation of Html.ImageGetter provided.
 *
 * @param html        String containing HTML, for example: "<b>Hello world!</b>"
 * @param imageGetter for fetching images. Possible ImageGetter provided by this library:
 *                    HtmlLocalImageGetter and HtmlRemoteImageGetter
 */
public void setHtml(@NonNull String html, @Nullable Html.ImageGetter imageGetter) {
    final HtmlTagHandler htmlTagHandler = new HtmlTagHandler(getPaint());
    htmlTagHandler.setClickableTableSpan(clickableTableSpan);
    htmlTagHandler.setDrawTableLinkSpan(drawTableLinkSpan);

    html = htmlTagHandler.overrideTags(html);

    if (removeTrailingWhiteSpace) {
        setText(removeHtmlBottomPadding(Html.fromHtml(html, imageGetter, htmlTagHandler)));
    } else {
        setText(Html.fromHtml(html, imageGetter, htmlTagHandler));
    }

    // make links work
    setMovementMethod(LocalLinkMovementMethod.getInstance());
}
 
开发者ID:SysdataSpA,项目名称:SDHtmlTextView,代码行数:25,代码来源:HtmlSpanTextView.java

示例3: obtainImageGetter

import android.text.Html; //导入方法依赖的package包/类
private Html.ImageGetter obtainImageGetter() {
	if (_imageGetter != null) {
		return _imageGetter;
	}
	_imageGetter = new Html.ImageGetter() {
		@Override
		public Drawable getDrawable(String source) {
			if (_imageCache == null) {
				_imageCache = new XulCachedHashMap<String, SpannedLabelImage>();
			}
			SpannedLabelImage spannedLabelImage = _imageCache.get(source);
			if (spannedLabelImage == null) {
				spannedLabelImage = new SpannedLabelImage();
				spannedLabelImage._source = source;
				_imageCache.put(source, spannedLabelImage);
				_imageCacheChanged = true;
			}
			if (spannedLabelImage._drawable == null) {
				return null;
			}
			return spannedLabelImage._drawable;
		}
	};
	return _imageGetter;
}
 
开发者ID:starcor-company,项目名称:starcor.xul,代码行数:26,代码来源:XulSpannedLabelRender.java


注:本文中的android.text.Html.ImageGetter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。