當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。