當前位置: 首頁>>代碼示例>>Java>>正文


Java SubscriptSpan類代碼示例

本文整理匯總了Java中android.text.style.SubscriptSpan的典型用法代碼示例。如果您正苦於以下問題:Java SubscriptSpan類的具體用法?Java SubscriptSpan怎麽用?Java SubscriptSpan使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SubscriptSpan類屬於android.text.style包,在下文中一共展示了SubscriptSpan類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setPenAttr

import android.text.style.SubscriptSpan; //導入依賴的package包/類
public void setPenAttr(CaptionPenAttr penAttr) {
    mCharacterStyles.clear();
    if (penAttr.italic) {
        mCharacterStyles.add(new StyleSpan(Typeface.ITALIC));
    }
    if (penAttr.underline) {
        mCharacterStyles.add(new UnderlineSpan());
    }
    switch (penAttr.penSize) {
        case CaptionPenAttr.PEN_SIZE_SMALL:
            mCharacterStyles.add(new RelativeSizeSpan(PROPORTION_PEN_SIZE_SMALL));
            break;
        case CaptionPenAttr.PEN_SIZE_LARGE:
            mCharacterStyles.add(new RelativeSizeSpan(PROPORTION_PEN_SIZE_LARGE));
            break;
    }
    switch (penAttr.penOffset) {
        case CaptionPenAttr.OFFSET_SUBSCRIPT:
            mCharacterStyles.add(new SubscriptSpan());
            break;
        case CaptionPenAttr.OFFSET_SUPERSCRIPT:
            mCharacterStyles.add(new SuperscriptSpan());
            break;
    }
}
 
開發者ID:trevd,項目名稱:android_packages_apps_tv,代碼行數:26,代碼來源:CaptionWindowLayout.java

示例2: handleEndTag

import android.text.style.SubscriptSpan; //導入依賴的package包/類
private void handleEndTag(CharacterStyle style) {
    if (style instanceof URLSpan) {
        mOut.append("</a>");
    } else if (style instanceof TypefaceSpan) {
        mOut.append("</font>");
    } else if (style instanceof ForegroundColorSpan) {
        mOut.append("</font>");
    } else if (style instanceof BackgroundColorSpan) {
        mOut.append("</font>");
    } else if (style instanceof AbsoluteSizeSpan) {
        mOut.append("</font>");
    } else if (style instanceof StrikethroughSpan) {
        mOut.append("</strike>");
    } else if (style instanceof SubscriptSpan) {
        mOut.append("</sub>");
    } else if (style instanceof SuperscriptSpan) {
        mOut.append("</sup>");
    } else if (style instanceof UnderlineSpan) {
        mOut.append("</u>");
    } else if (style instanceof BoldSpan) {
        mOut.append("</b>");
    } else if (style instanceof ItalicSpan) {
        mOut.append("</i>");
    }
}
 
開發者ID:Ronak-LM,項目名稱:memoir,代碼行數:26,代碼來源:ConverterSpannedToHtml.java

示例3: subscript_should_add_only_one_span

import android.text.style.SubscriptSpan; //導入依賴的package包/類
@Test
public void subscript_should_add_only_one_span() {
    spanBuilder.style(range, EZ.SUBSCRIPT)
               .apply();

    verify((SpanEZ) spanBuilder, times(1))
            .addSpan(isA(TargetRange.class), isA(SubscriptSpan.class));
}
 
開發者ID:yombunker,項目名稱:SpanEZ,代碼行數:9,代碼來源:SpanEZTest.java

示例4: setSubscriptSpan

import android.text.style.SubscriptSpan; //導入依賴的package包/類
public MIP_TextStyle setSubscriptSpan(int start, int end)
{
    if (spannableString == null)
    {
        return this;
    }
    spannableString.setSpan(new SubscriptSpan(), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // 設置前景色為洋紅色
    return this;
}
 
開發者ID:zhuyu1022,項目名稱:amap,代碼行數:10,代碼來源:MIP_TextStyle.java

示例5: subscript

import android.text.style.SubscriptSpan; //導入依賴的package包/類
/**
 * @see SubscriptSpan#SubscriptSpan()
 */
public static Span subscript() {
    return new Span(new SpanBuilder() {
        @Override
        public Object build() {
            return new SubscriptSpan();
        }
    });
}
 
開發者ID:neworld,項目名稱:spanner,代碼行數:12,代碼來源:Spans.java

示例6: subscript

import android.text.style.SubscriptSpan; //導入依賴的package包/類
/**
 * SubscriptSpan,設置下標
 */
private void subscript () {
    SpannableString string = new SpannableString("為文字設置下劃線");
    RelativeSizeSpan sizeSpan = new RelativeSizeSpan(0.7f);
    string.setSpan(sizeSpan, 5, string.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
    SubscriptSpan superscriptSpan = new SubscriptSpan();
    string.setSpan(superscriptSpan, 5, string.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
    bgtext.setText(string);
}
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:12,代碼來源:SpannableStringActivity.java

示例7: setSubscript

import android.text.style.SubscriptSpan; //導入依賴的package包/類
public TextDecorator setSubscript(final String... texts) {
  int index;

  for (String text : texts) {
    if (content.contains(text)) {
      index = content.indexOf(text);
      decoratedContent.setSpan(new SubscriptSpan(), index, index + text.length(), flags);
    }
  }

  return this;
}
 
開發者ID:nntuyen,項目名稱:text-decorator,代碼行數:13,代碼來源:TextDecorator.java

示例8: attachToView

import android.text.style.SubscriptSpan; //導入依賴的package包/類
public void attachToView(ViewGroup targetView) {
	for (int i = 0; i < 3; ++i) {
		ViewGroup g = (ViewGroup) targetView.getChildAt(i);
		TextView label = (TextView) g.getChildAt(0);
		Slider slider = (Slider) g.getChildAt(1);
		TextView valueText = (TextView) g.getChildAt(2);
		SliderPositionListener positionListener = new LedValueUpdater(valueText, i);
		slider.setPositionListener(positionListener);
		LabelClickListener leftLabelListener = new LabelClickListener(slider, 0);
		label.setOnClickListener(leftLabelListener);
		LabelClickListener rightLabelListener = new LabelClickListener(slider, 1);
		valueText.setOnClickListener(rightLabelListener);
		valueText.setText("0");
		if (i == 0) {
			String labelText = "Led";
			SpannableStringBuilder ssb = new SpannableStringBuilder(labelText);
			ssb.append(String.valueOf(mLEDNumber));
			int spanStart = labelText.length();
			int spanEnd = spanStart + 1;
			ssb.setSpan(new SubscriptSpan(), spanStart, spanEnd, 0);
			ssb.setSpan(new RelativeSizeSpan(0.7f), spanStart, spanEnd, 0);
			label.setText(ssb);
			slider.setSliderBackground(mRed);
		} else {
			label.setText("");
			if (i == 1) {
				slider.setSliderBackground(mGreen);
			} else {
				slider.setSliderBackground(mBlue);
			}
		}
	}
}
 
開發者ID:matrix-io,項目名稱:matrix-creator-malos-android,代碼行數:34,代碼來源:ColorLEDController.java

示例9: onSpanClick

import android.text.style.SubscriptSpan; //導入依賴的package包/類
@Override
public void onSpanClick(SpanButton v) {
    View view=richEdit.findFocus();
    BaseRichEditText editText;
    if(view instanceof BaseRichEditText){
        editText=(BaseRichEditText)view;
    }else {
        return;
    }
    TypedValue typedValue = new TypedValue();
    getContext().getTheme().resolveAttribute(R.attr.colorAccent, typedValue, true);
    int color=typedValue.data;
    switch (v.getSpan()){
        case SpanButton.SPAN_BOLD:editText.toggleBold();if(editText.isBold()){editText.applyStyleSpan(Typeface.BOLD);v.setColor(color);}else {editText.removeSelectionSpan(Typeface.BOLD);v.setColor(0xff757575);}break;
        case SpanButton.SPAN_ITALIC:editText.toggleItalic();if(editText.isItalic()){editText.applyStyleSpan(Typeface.ITALIC);v.setColor(color);}else {editText.removeSelectionSpan(Typeface.ITALIC);v.setColor(0xff757575);}break;
        case SpanButton.SPAN_STRIKETHROUGH:editText.toggleStrikethrough();if(editText.isStrikethrough()){editText.applySelectionSpan(StrikethroughSpan.class);v.setColor(color);}else {editText.removeSelectionSpan(StrikethroughSpan.class);v.setColor(0xff757575);}break;
        case SpanButton.SPAN_UNDERLINE:editText.toggleUnderLine();if(editText.isUnderLine()){editText.applySelectionSpan(UnderlineSpan.class);v.setColor(color);}else {editText.removeSelectionSpan(UnderlineSpan.class);v.setColor(0xff757575);}break;
        case SpanButton.SPAN_FOREGROUND:editText.toggleForegroundColor();if(editText.isForegroundColor()){editText.applyColorSpan(ForegroundColorSpan.class,v.getGroundColor());v.setColor(v.getGroundColor());}else {editText.removeSelectionSpan(ForegroundColorSpan.class);v.setColor(0xff757575);}break;
        case SpanButton.SPAN_BACKGROUND:editText.toggleBackgroundColor();if(editText.isBackgroundColor()){editText.applyColorSpan(BackgroundColorSpan.class,v.getGroundColor());v.setColor(v.getGroundColor());}else {editText.removeSelectionSpan(BackgroundColorSpan.class);v.setColor(0xff757575);}break;
        case SpanButton.SPAN_SUBSCRIPT:editText.toggleSubscript();if(editText.isSubscript()){editText.applyScriptSpan(SubscriptSpan.class);v.setColor(color);}else {editText.removeSelectionSpan(SubscriptSpan.class);v.setColor(0xff757575);}break;
        case SpanButton.SPAN_SUPERSCRIPT:editText.toggleSuperscript();if(editText.isSuperscript()){editText.applyScriptSpan(SuperscriptSpan.class);v.setColor(color);}else {editText.removeSelectionSpan(SuperscriptSpan.class);v.setColor(0xff757575);}break;
        case SpanButton.SPAN_TODO:richEdit.addTodoLayout((BaseContainer) richEdit.findFocus().getParent().getParent());break;
        case SpanButton.SPAN_DOT:richEdit.addDotLayout((BaseContainer) richEdit.findFocus().getParent().getParent());break;
        case SpanButton.SPAN_NUMERIC:richEdit.addNumericLayout((BaseContainer) richEdit.findFocus().getParent().getParent());break;
        case SpanButton.SPAN_PHOTO:richEdit.addPhotoLayout((BaseContainer) richEdit.findFocus().getParent().getParent());break;
        //case SpanButton.SPAN_TEXTSIZE:editText.changeSize();editText.applyRelativeSpan();break;
        //case SpanButton.SPAN_BOLD:editText.toggleBold();if(editText.isBold()){editText.applyStyleSpan(Typeface.BOLD);v.setColor(color);}else {editText.removeSelectionSpan(Typeface.BOLD);v.setColor(0xff757575);}break;
    }
}
 
開發者ID:tianyuan168326,項目名稱:nono-android,代碼行數:30,代碼來源:EditView.java

示例10: processSub

import android.text.style.SubscriptSpan; //導入依賴的package包/類
private void processSub( boolean opening, Editable output) {

        int len = output.length();
        if(opening) {
            //output.setSpan(new RelativeSizeSpan(0.5f), len, len, Spannable.SPAN_MARK_MARK);
            output.setSpan(new SubscriptSpan(), len, len, Spannable.SPAN_MARK_MARK);
            //output.setSpan(new AbsoluteSizeSpan(scriptSize,false), len, len, Spannable.SPAN_MARK_MARK);
        } else {
            Object obj = getLast(output, SubscriptSpan.class);
            int where = output.getSpanStart(obj);
            output.removeSpan(obj);
            //obj = getLast(output, RelativeSizeSpan.class);
            //output.removeSpan(obj);
            if (where != len&&where>=0) {
                //output.setSpan(new AbsoluteSizeSpan(scriptSize, false), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                output.setSpan(new RelativeSizeSpan(0.7f), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                output.setSpan(new SubscriptSpan(), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            }
           // obj = getLast(output, AbsoluteSizeSpan.class);
           // where = output.getSpanStart(obj);
           // output.removeSpan(obj);
           // if (where != len) {
           //     output.setSpan(new AbsoluteSizeSpan(scriptSize, false), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
           //     //output.setSpan(new RelativeSizeSpan(0.5f), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
           // }
        }
    }
 
開發者ID:tianyuan168326,項目名稱:nono-android,代碼行數:28,代碼來源:MyHtmlTagHandler.java

示例11: showSubscriptSpan

import android.text.style.SubscriptSpan; //導入依賴的package包/類
/**
 * 設置文字下標
 */
private void showSubscriptSpan()
{
    TextView tvSubScriptSpan = (TextView) findViewById(R.id.tv_subscript_span);
    SpannableString spannableString = new SpannableString("這是第七行設置文字下標:CO2");
    SubscriptSpan subscriptSpan = new SubscriptSpan();
    spannableString.setSpan(subscriptSpan, spannableString.length()-1, spannableString.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
    tvSubScriptSpan.setText(spannableString);
}
 
開發者ID:baoyachi,項目名稱:SpannableStringDemo,代碼行數:12,代碼來源:MainActivity.java

示例12: setUpSubscriptSpan

import android.text.style.SubscriptSpan; //導入依賴的package包/類
private static void setUpSubscriptSpan(Span span, SpannableString ss, int start, int end) {
    if (span.isSubscript()) {
        ss.setSpan(
            new SubscriptSpan(),
            start,
            end,
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
}
 
開發者ID:lawloretienne,項目名稱:Trestle,代碼行數:10,代碼來源:Trestle.java

示例13: subscript

import android.text.style.SubscriptSpan; //導入依賴的package包/類
public static Node subscript(Object... nodes) {
    return new SpanNode(new SubscriptSpan(), nodes);
}
 
開發者ID:SimonMarquis,項目名稱:Android-Spans,代碼行數:4,代碼來源:Span.java

示例14: handleTagNode

import android.text.style.SubscriptSpan; //導入依賴的package包/類
@Override public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end) {
    builder.setSpan(new SubscriptSpan(), start, end, 33);
    builder.setSpan(new RelativeSizeSpan(0.8f), start, end, 33);
}
 
開發者ID:duyp,項目名稱:mvvm-template,代碼行數:5,代碼來源:SubScriptHandler.java

示例15: handleTagNode

import android.text.style.SubscriptSpan; //導入依賴的package包/類
public void handleTagNode(TagNode node, SpannableStringBuilder builder,
		int start, int end, SpanStack spanStack) {

	spanStack.pushSpan(new SubscriptSpan(), start, end);
}
 
開發者ID:SysdataSpA,項目名稱:SDHtmlTextView,代碼行數:6,代碼來源:SubScriptHandler.java


注:本文中的android.text.style.SubscriptSpan類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。