Android TypefaceSpan - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android TypefaceSpan class.

This code example shows how to use the following methods:
     * 
     * @param text 
     * @return this text 
     */ 
    public StyledText monospace(final CharSequence text) {
        return append(text, new TypefaceSpan("monospace"));
    } 
 
    /** 
     * Append text as URL 
     * 
     * @param text 
     * @param listener 
     * @return this text 
     */ 
    public StyledText url(final CharSequence text,
            final OnClickListener listener) {
        return append(text, new URLSpan(text.toString()) {
 
            @Override 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		} 
 
		TypefaceSpan fontSpan;
		switch (font) {
		case 1: 
			fontSpan = new TypefaceSpan("sans-serif-condensed");
			break; 
		case 2: 
			fontSpan = new TypefaceSpan("sans-serif-light");
			break; 
		case 3: 
			fontSpan = new TypefaceSpan("sans-serif-thin");
			break; 
		default: 
			fontSpan = new TypefaceSpan("sans-serif");
			break; 
		} 
 
		SpannableString ss = new SpannableString(text);
		if (titleEnd > 0) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
				if (c != -1) {
					mSB.setSpan(new ForegroundColorSpan(c | 0xFF000000), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
				} 
			} 
			if (face != null) {
				mSB.setSpan(new TypefaceSpan(face), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
			} 
			if (size != null) {
				mSB.setSpan(Util.sizeToSpan(size), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
			} 
		} 
	} 
 
	private void endA(TagMarker tm) {
		int end = mSB.length();
		int start = tm.getStart();
		if (start != end) {
			String href = tm.getAttributes().getValue("", "href");
			if (href != null) {
				mSB.setSpan(new URLSpan(href), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 */ 
	public static SpannableString buildCondensedFontString(String string) {
		if (string == null)
			return null; 
		SpannableString s = new SpannableString(string);
		s.setSpan(new TypefaceSpan("sans-serif-condensed"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
		return s;
	} 
 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        s.setSpan(new StyleSpan(Typeface.ITALIC), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <i>italic</i> world</p>\n");
 
        s = new SpannableString("Hello monospace world");
        s.setSpan(new TypefaceSpan("monospace"), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <tt>monospace</tt> world</p>\n");
 
        s = new SpannableString("Hello superscript world");
        s.setSpan(new SuperscriptSpan(), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <sup>superscript</sup> world</p>\n");
 
        s = new SpannableString("Hello subscript world");
        s.setSpan(new SubscriptSpan(), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <sub>subscript</sub> world</p>\n");
 
        s = new SpannableString("Hello underline world");
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     * 
     * @param text 
     * @return this text 
     */ 
    public StyledText monospace(final CharSequence text) {
        return append(text, new TypefaceSpan("monospace"));
    } 
 
    /** 
     * Append text as URL 
     * 
     * @param text 
     * @param listener 
     * @return this text 
     */ 
    public StyledText url(final CharSequence text,
            final OnClickListener listener) {
        return append(text, new URLSpan(text.toString()) {
 
            @Override 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        s.setSpan(new StyleSpan(Typeface.ITALIC), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <i>italic</i> world</p>\n");
 
        s = new SpannableString("Hello monospace world");
        s.setSpan(new TypefaceSpan("monospace"), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <tt>monospace</tt> world</p>\n");
 
        s = new SpannableString("Hello superscript world");
        s.setSpan(new SuperscriptSpan(), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <sup>superscript</sup> world</p>\n");
 
        s = new SpannableString("Hello subscript world");
        s.setSpan(new SubscriptSpan(), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <sub>subscript</sub> world</p>\n");
 
        s = new SpannableString("Hello underline world");
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     * @param starIndex 
     * @param endIndex 
     */ 
    public void getTypefaceSpan(SpannableString spannableString,
                                String typeface, int starIndex, int endIndex) {
        spannableString.setSpan(new TypefaceSpan(typeface), starIndex,
                endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    } 
 
    /** 
     * 设置绝对字体大小(单位:像素) 
     * 
     * @param spannableString 
     * @param pixel 
     * @param starIndex 
     * @param endIndex 
     */ 
    public void getAbsoluteSizeSpan(SpannableString spannableString, int pixel,
                                    int starIndex, int endIndex) {
        spannableString.setSpan(new AbsoluteSizeSpan(pixel), starIndex,
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
                    } 
                } 
            } 
 
            if (f.mFace != null) {
                text.setSpan(new TypefaceSpan(f.mFace), where, len,
                        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            } 
        } 
    } 
 
    private static void startA(SpannableStringBuilder text,
            Attributes attributes) {
        String href = attributes.getValue("", "href");
 
        int len = text.length();
        text.setSpan(new Href(href), len, len, Spannable.SPAN_MARK_MARK);
    } 
 
    private static void endA(SpannableStringBuilder text) {
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
				if (c != -1) {
					mSB.setSpan(new ForegroundColorSpan(c | 0xFF000000), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
				} 
			} 
			if (face != null) {
				mSB.setSpan(new TypefaceSpan(face), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
			} 
			if (size != null) {
				mSB.setSpan(Util.sizeToSpan(size), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
			} 
		} 
	} 
 
	private void endA(TagMarker tm) {
		int end = mSB.length();
		int start = tm.getStart();
		if (start != end) {
			String href = tm.getAttributes().getValue("", "href");
			if (href != null) {
				mSB.setSpan(new URLSpan(href), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
3
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android TypefaceSpan Questions & Answers:

See Code Examples for Android TypefaceSpan Methods: