Standard()源码实例Demo

android.text.style.AlignmentSpan#Standard()源码实例Demo

下面列出了android.text.style.AlignmentSpan#Standard() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Markwon   文件: HtmlActivity.java
@Nullable
@Override
public Object getSpans(
        @NonNull MarkwonConfiguration configuration,
        @NonNull RenderProps renderProps,
        @NonNull HtmlTag tag) {

    final Layout.Alignment alignment;

    // html attribute without value, <align center></align>
    if (tag.attributes().containsKey("center")) {
        alignment = Layout.Alignment.ALIGN_CENTER;
    } else if (tag.attributes().containsKey("end")) {
        alignment = Layout.Alignment.ALIGN_OPPOSITE;
    } else {
        // empty value or any other will make regular alignment
        alignment = Layout.Alignment.ALIGN_NORMAL;
    }

    return new AlignmentSpan.Standard(alignment);
}
 
源代码2 项目: advanced-textview   文件: AlignmentSpanActivity.java
private void appendText(CharSequence text, Layout.Alignment align) {
  if (text == null || text.toString().trim().length() == 0) {
    return;
  }

  AlignmentSpan span = new AlignmentSpan.Standard(align);
  SpannableString spannableString = new SpannableString(text);
  spannableString.setSpan(span, 0, text.length(), 0);

  if (textView.length() > 0) {
    textView.append("\n\n");
  }
  textView.append(spannableString);
}
 
源代码3 项目: SpanEZ   文件: SpanEZ.java
@Override
public StyleEZ alignCenter(@NonNull ParagraphLocator paragraph) {
    AlignmentSpan centerSpan = new AlignmentSpan.Standard(Layout.Alignment.ALIGN_CENTER);
    addMultipleSpan(paragraph, centerSpan);
    return this;
}
 
源代码4 项目: SpanEZ   文件: SpanEZ.java
@Override
public StyleEZ alignEnd(@NonNull ParagraphLocator paragraph) {
    AlignmentSpan oppositeSpan = new AlignmentSpan.Standard(Layout.Alignment.ALIGN_OPPOSITE);
    addMultipleSpan(paragraph, oppositeSpan);
    return this;
}
 
源代码5 项目: SpanEZ   文件: SpanEZ.java
@Override
public StyleEZ alignStart(@NonNull ParagraphLocator paragraph) {
    AlignmentSpan normalSpan = new AlignmentSpan.Standard(Layout.Alignment.ALIGN_NORMAL);
    addMultipleSpan(paragraph, normalSpan);
    return this;
}
 
源代码6 项目: AndroidSpan   文件: SpanOptions.java
public SpanOptions addAlignmentSpan(Layout.Alignment align) {
    AlignmentSpan.Standard span = new AlignmentSpan.Standard(align);
    listSpan.add(span);
    return this;
}
 
源代码7 项目: AndroidSpan   文件: AndroidSpan.java
/**
 * 标准文本对齐样式
 *
 * @param text
 * @param align "ALIGN_CENTER"、"ALIGN_NORMAL" 或"ALIGN_OPPOSITE"中的之一
 * @return
 */
public AndroidSpan drawAlignmentSpan(String text, Layout.Alignment align) {
    AlignmentSpan.Standard span = new AlignmentSpan.Standard(align);
    drawSpan(text, span);
    return this;
}
 
源代码评论
动弹
沙发等你来抢
 同类方法