android.text.Html.fromHtml()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中android.text.Html.fromHtml()方法的一些代码示例,展示了Html.fromHtml()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Html.fromHtml()方法的具体详情如下:
包路径:android.text.Html
类名称:Html
方法名:fromHtml

Html.fromHtml介绍

暂无

代码示例

代码示例来源:origin: pockethub/PocketHub

/**
 * Encode HTML
 *
 * @param html
 * @param imageGetter
 * @return html
 */
public static CharSequence encode(final String html,
                 final ImageGetter imageGetter) {
  if (TextUtils.isEmpty(html)) {
    return "";
  }
  return Html.fromHtml(html, imageGetter, TAG_HANDLER);
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public View getView(int position, View convertView, ViewGroup parent) {
  View row=super.getView(position, convertView, parent);
  TextView title=row.findViewById(android.R.id.text1);
  title.setText(Html.fromHtml(getItem(position).title));
  return(row);
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public View getView(int position, View convertView, ViewGroup parent) {
  View row=super.getView(position, convertView, parent);
  TextView title=row.findViewById(android.R.id.text1);
  title.setText(Html.fromHtml(getItem(position).title));
  return(row);
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public View getView(int position, View convertView, ViewGroup parent) {
  View row=super.getView(position, convertView, parent);
  TextView title=(TextView)row.findViewById(android.R.id.text1);
  title.setText(Html.fromHtml(getItem(position).title));
  return(row);
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public View getView(int position, View convertView, ViewGroup parent) {
  View row=super.getView(position, convertView, parent);
  TextView title=(TextView)row.findViewById(android.R.id.text1);
  title.setText(Html.fromHtml(getItem(position).title));
  return(row);
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public View getView(int position, View convertView, ViewGroup parent) {
  View row=super.getView(position, convertView, parent);
  TextView title=row.findViewById(android.R.id.text1);
  title.setText(Html.fromHtml(getItem(position).title));
  return(row);
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public View getView(int position, View convertView, ViewGroup parent) {
  View row=super.getView(position, convertView, parent);
  TextView title=(TextView)row.findViewById(android.R.id.text1);
  title.setText(Html.fromHtml(getItem(position).title));
  return(row);
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public View getView(int position, View convertView, ViewGroup parent) {
  View row=super.getView(position, convertView, parent);
  TextView title=(TextView)row.findViewById(android.R.id.text1);
  title.setText(Html.fromHtml(getItem(position).title));
  return(row);
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public View getView(int position, View convertView, ViewGroup parent) {
  View row=super.getView(position, convertView, parent);
  TextView title=(TextView)row.findViewById(android.R.id.text1);
  title.setText(Html.fromHtml(getItem(position).title));
  return(row);
 }
}

代码示例来源:origin: lingochamp/FileDownloader

@Override
protected void error(BaseDownloadTask task, Throwable e) {
  finalCounts++;
  updateDisplay(Html.fromHtml(String.format("[error] id[%d] %s %s",
      task.getId(),
      e,
      FileDownloadUtils.getStack(e.getStackTrace(), false))));
  updateDisplay(String.format("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %d", (Integer) task.getTag()));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public View getView(int position, View convertView, ViewGroup parent) {
  View row=super.getView(position, convertView, parent);
  TextView title=(TextView)row.findViewById(android.R.id.text1);
  title.setText(Html.fromHtml(getItem(position).getTitle()));
  return(row);
 }
}

代码示例来源:origin: robolectric/robolectric

@Config(maxSdk = M)
@Test public void testArraycopyLegacyShort() {
 //noinspection deprecation
 Html.fromHtml(HTML_SHORT, null, null);
}

代码示例来源:origin: robolectric/robolectric

@Config(maxSdk = M)
@Test public void testArraycopyLegacyLong() {
 //noinspection deprecation
 Html.fromHtml(HTML_LONG, null, null);
}

代码示例来源:origin: robolectric/robolectric

/**
 * this test requires that {@link org.ccil.cowan.tagsoup.HTMLScanner} be instrumented.
 */
@TargetApi(N) @Config(minSdk = N)
@Test public void testArraycopyLong() {
 Html.fromHtml(HTML_LONG, Html.FROM_HTML_MODE_LEGACY, null, null);
}

代码示例来源:origin: robolectric/robolectric

@Test(expected = NullPointerException.class)
public void shouldThrowNullPointerExceptionWhenNullStringEncountered() throws Exception {
 Html.fromHtml(null);
}

代码示例来源:origin: robolectric/robolectric

@TargetApi(N) @Config(minSdk = N)
@Test public void testArraycopyShort() {
 Html.fromHtml(HTML_SHORT, Html.FROM_HTML_MODE_LEGACY, null, null);
}

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldBeAbleToGetTextFromTextViewAfterUsingSetTextWithHtmlDotFromHtml() throws Exception {
 TextView textView = new TextView(context);
 textView.setText(Html.fromHtml("<b>some</b> html text"));
 assertThat(textView.getText().toString()).isEqualTo("some html text");
}

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldBeAbleToGetTextFromEditTextAfterUsingSetTextWithHtmlDotFromHtml() throws Exception {
 EditText editText = new EditText(context);
 editText.setText(Html.fromHtml("<b>some</b> html text"));
 assertThat(editText.getText().toString()).isEqualTo("some html text");
}

代码示例来源:origin: robolectric/robolectric

@Test
public void fromHtml_shouldJustReturnArgByDefault() {
 String text = "<b>foo</b>";
 Spanned spanned = Html.fromHtml(text);
 assertThat(spanned.toString()).isEqualTo("foo");
}

代码示例来源:origin: greenrobot/EventBus

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(TestFinishedEvent event) {
  Test test = event.test;
  String text = "<b>" + test.getDisplayName() + "</b><br/>" + //
      test.getPrimaryResultMicros() + " micro seconds<br/>" + //
      ((int) test.getPrimaryResultRate()) + "/s<br/>";
  if (test.getOtherTestResults() != null) {
    text += test.getOtherTestResults();
  }
  text += "<br/>----------------<br/>";
  textViewResult.append(Html.fromHtml(text));
  if (event.isLastEvent) {
    findViewById(R.id.buttonCancel).setVisibility(View.GONE);
    findViewById(R.id.textViewTestRunning).setVisibility(View.GONE);
    findViewById(R.id.buttonKillProcess).setVisibility(View.VISIBLE);
  }
}

相关文章

微信公众号

最新文章

更多