Android SubscriptSpan - 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 SubscriptSpan class.

This code example shows how to use the following methods:
public class SubScriptHandler extends TagNodeHandler { 
 
	public void handleTagNode(TagNode node, SpannableStringBuilder builder, 
			int start, int end, SpanStack spanStack) { 
 
		spanStack.pushSpan(new SubscriptSpan(), start, end); 
	} 
} 
Full Snippet Info
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
	public void attachToView(ViewGroup targetView) {
		mLabel = (TextView) targetView.getChildAt(0);
		SpannableStringBuilder ssb = new SpannableStringBuilder("Relay");
		ssb.append(String.valueOf(mRelayNumber));
		ssb.setSpan(new SubscriptSpan(), 5, 6, 0);
		ssb.setSpan(new RelativeSizeSpan(0.7f), 5, 6, 0);
		mLabel.setText(ssb);
		mButton = (ToggleButton) targetView.getChildAt(1);
		mButton.setOnCheckedChangeListener(this);
	} 
 
	public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
		if (isChecked) {
			mButton.setBackgroundDrawable(mOnBackground);
		} else { 
			mButton.setBackgroundDrawable(mOffBackground);
		} 
		if (mActivity != null) {
			mActivity.sendCommand(DemoKitActivity.RELAY_COMMAND,
Full Snippet Info
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        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");
        s.setSpan(new UnderlineSpan(), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <u>underline</u> world</p>\n");
 
        s = new SpannableString("Hello struck world");
        s.setSpan(new StrikethroughSpan(), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <strike>struck</strike> world</p>\n");
 
        s = new SpannableString("Hello linky world");
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
	public void attachToView(ViewGroup targetView) {
		mLabel = (TextView) targetView.getChildAt(0);
		SpannableStringBuilder ssb = new SpannableStringBuilder("Servo");
		ssb.append(String.valueOf(mServoNumber));
		ssb.setSpan(new SubscriptSpan(), 5, 6, 0);
		ssb.setSpan(new RelativeSizeSpan(0.7f), 5, 6, 0);
		mLabel.setText(ssb);
		mSlider = (Slider) targetView.getChildAt(1);
		mSlider.setPositionListener(this);
	} 
 
	public void onPositionChange(double value) {
		byte v = (byte) (value * 255);
		mActivity.sendCommand(DemoKitActivity.LED_SERVO_COMMAND,
				mCommandTarget, v);
	} 
 
} 
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
	public void attachToView(ViewGroup targetView) {
		mLabel = (TextView) targetView.getChildAt(0);
		SpannableStringBuilder ssb = new SpannableStringBuilder("Servo");
		ssb.append(String.valueOf(mServoNumber));
		ssb.setSpan(new SubscriptSpan(), 5, 6, 0);
		ssb.setSpan(new RelativeSizeSpan(0.7f), 5, 6, 0);
		mLabel.setText(ssb);
		mSlider = (Slider) targetView.getChildAt(1);
		mSlider.setPositionListener(this);
	} 
 
	public void onPositionChange(double value) {
		byte v = (byte) (value * 255);
		mActivity.sendCommand(DemoKitActivity.LED_SERVO_COMMAND,
				mCommandTarget, v);
	} 
 
} 
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        return getSubscriptString(base, 0, base.length() - 1);
    } 
 
    public static CharSequence getSubscriptString(CharSequence base, int startFromIdx, int endAtIdx) {
        SpannableString str = new SpannableString(base);
        str.setSpan(new SubscriptSpan(), startFromIdx, endAtIdx, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
        return str;
    } 
 
    /** 
     * Check if given string value is empty or null 
     * 
     * @param value 
     * @return 
     */ 
    public static boolean isEmptyOrNull(String value) {
        return ((value == null) || (value.equals("")));
    } 
 
    public static boolean isEmptyOrNull(CharSequence value) {
Full Snippet Info
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        return getSubscriptString(base, 0, base.length() - 1);
    } 
 
    public static CharSequence getSubscriptString(CharSequence base, int startFromIdx, int endAtIdx) {
        SpannableString str = new SpannableString(base);
        str.setSpan(new SubscriptSpan(), startFromIdx, endAtIdx, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
        return str;
    } 
 
    /** 
     * Check if given string value is empty or null 
     * 
     * @param value 
     * @return 
     */ 
    public static boolean isEmptyOrNull(String value) {
        return ((value == null) || (value.equals("")));
    } 
 
    public static boolean isEmptyOrNull(CharSequence value) {
Full Snippet Info
3
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 getSubscriptSpan(SpannableString spannableString,
			int starIndex, int endIndex) {
		spannableString.setSpan(new SubscriptSpan(), starIndex, endIndex,
				Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
	} 
 
	/** 
	 * 设置上标 
	 *  
	 * @param spannableString 
	 * @param starIndex 
	 * @param endIndex 
	 */ 
	public void getSuperscriptSpan(SpannableString spannableString,
			int starIndex, int endIndex) {
		spannableString.setSpan(new SuperscriptSpan(), starIndex, endIndex,
				Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
Full Snippet Info
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 getSubscriptSpan(SpannableString spannableString,
                                 int starIndex, int endIndex) {
        spannableString.setSpan(new SubscriptSpan(), starIndex, endIndex,
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    } 
 
    /** 
     * 设置上标 
     * 
     * @param spannableString 
     * @param starIndex 
     * @param endIndex 
     */ 
    public void getSuperscriptSpan(SpannableString spannableString,
                                   int starIndex, int endIndex) {
        spannableString.setSpan(new SuperscriptSpan(), starIndex, endIndex,
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        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");
        s.setSpan(new UnderlineSpan(), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <u>underline</u> world</p>\n");
 
        s = new SpannableString("Hello struck world");
        s.setSpan(new StrikethroughSpan(), 6, s.length() - 6,
                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        assertEquals(Html.toHtml(s), "<p>Hello <strike>struck</strike> world</p>\n");
 
        s = new SpannableString("Hello linky world");
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Android SubscriptSpan Methods: