本文整理匯總了Java中android.text.style.LeadingMarginSpan.Standard方法的典型用法代碼示例。如果您正苦於以下問題:Java LeadingMarginSpan.Standard方法的具體用法?Java LeadingMarginSpan.Standard怎麽用?Java LeadingMarginSpan.Standard使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.text.style.LeadingMarginSpan
的用法示例。
在下文中一共展示了LeadingMarginSpan.Standard方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getReplaces
import android.text.style.LeadingMarginSpan; //導入方法依賴的package包/類
@Override
protected Object[] getReplaces(final Editable text, final int indentation) {
// Nested BulletSpans increases distance between BULLET_SPAN and text, so we must prevent it.
int bulletMargin = INDENT_PX;
if (indentation > 1) {
bulletMargin = INDENT_PX - BULLET_SPAN.getLeadingMargin(true);
if (indentation > 2) {
// This get's more complicated when we add a LeadingMarginSpan into the same line:
// we have also counter it's effect to BulletSpan
bulletMargin -= (indentation - 2) * LIST_ITEM_INDENT_PX;
}
}
return new Object[]{
new LeadingMarginSpan.Standard(LIST_ITEM_INDENT_PX * (indentation - 1)),
new BulletSpan(bulletMargin)
};
}
示例2: writeSingleParagraphStyle
import android.text.style.LeadingMarginSpan; //導入方法依賴的package包/類
private void writeSingleParagraphStyle(ParagraphStyle style, DataOutputStream dos) throws IOException {
Class clazz = style.getClass();
dos.writeInt(mString.getSpanStart(style));
dos.writeInt(mString.getSpanEnd(style));
dos.writeInt(mString.getSpanFlags(style));
if (mCharacterStylesTags.containsKey(clazz.getSimpleName())) {
int tag = mCharacterStylesTags.get(clazz.getSimpleName());
if (mCharacterStylesTags.containsKey(clazz.getSimpleName())) {
dos.writeInt(tag);
}
switch (tag) {
case 24: // AligmentSpan.Standard
AlignmentSpan.Standard as2 = (AlignmentSpan.Standard)style;
dos.writeInt(as2.getAlignment().ordinal());
break;
case 25: // BulletSpan
BulletSpan bs = (BulletSpan)style;
dos.writeInt(bs.getLeadingMargin(true));
dos.writeInt(bs.getLeadingMargin(false));
break;
case 30: // LeadingMarginSpan.Sandard
LeadingMarginSpan.Standard lms = (LeadingMarginSpan.Standard)style;
dos.writeInt(lms.getLeadingMargin(true));
dos.writeInt(lms.getLeadingMargin(false));
break;
case 34: // QuoteSpan
QuoteSpan qs = (QuoteSpan)style;
dos.writeInt(qs.getColor());
break;
case 36: // TabStopSpan.Standard
TabStopSpan.Standard tss = (TabStopSpan.Standard)style;
dos.writeInt(tss.getTabStop());
break;
default:
}
} else {
write(style,dos);
}
}
示例3: readSingleParagraph
import android.text.style.LeadingMarginSpan; //導入方法依賴的package包/類
private SpanPlacementInfo readSingleParagraph(DataInputStream dis) throws IOException {
SpanPlacementInfo spi = new SpanPlacementInfo();
spi.start = dis.readInt();
spi.end = dis.readInt();
spi.mode = dis.readInt();
int tag = dis.readInt(); // mCharacterStylesTags.get(clazz.getSimpleName());
switch (tag) {
case 24: // AligmentSpan.Standard
spi.span = new AlignmentSpan.Standard(Alignment.values()[dis.readInt()]);
break;
case 25: // BulletSpan
spi.span = new BulletSpan(dis.readInt());
dis.readInt(); // skip gap width for other lines
break;
case 30: // LeadingMarginSpan.Sandard
spi.span = new LeadingMarginSpan.Standard(dis.readInt(),dis.readInt());
break;
case 34: // QuoteSpan
spi.span = new QuoteSpan(dis.readInt());
break;
case 36: // TabStopSpan.Standard
spi.span = new TabStopSpan.Standard(dis.readInt());
break;
case 80: // RemoteDrawableSpan
break;
default:
spi.span = read(tag,dis);
}
return spi;
}
示例4: leadingMargin
import android.text.style.LeadingMarginSpan; //導入方法依賴的package包/類
public static Node leadingMargin(Integer every, Object... nodes) {
return new SpanNode(new LeadingMarginSpan.Standard(every), nodes);
}
示例5: getNode
import android.text.style.LeadingMarginSpan; //導入方法依賴的package包/類
private TagNode getNode (Object span) {
TagNode node = new TagNode();
node.start = noteContent.getSpanStart(span);
node.end = noteContent.getSpanEnd(span);
if( span instanceof StyleSpan ) {
StyleSpan style = (StyleSpan) span;
if( (style.getStyle()&Typeface.BOLD)>0 )
{
node.setType(TagType.BOLD);
}
if( (style.getStyle()&Typeface.ITALIC)>0 )
{
node.setType(TagType.ITALIC);
}
}
else if( span instanceof StrikethroughSpan )
{
node.setType(TagType.STRIKETHROUGH);
}
else if( span instanceof BackgroundColorSpan )
{
BackgroundColorSpan bgcolor = (BackgroundColorSpan) span;
if( bgcolor.getBackgroundColor()==Note.NOTE_HIGHLIGHT_COLOR )
{
node.setType(TagType.HIGHLIGHT);
}
}
else if( span instanceof TypefaceSpan )
{
TypefaceSpan typeface = (TypefaceSpan) span;
if( typeface.getFamily()==Note.NOTE_MONOSPACE_TYPEFACE )
{
node.setType(TagType.MONOSPACE);
}
}
else if( span instanceof RelativeSizeSpan )
{
RelativeSizeSpan size = (RelativeSizeSpan) span;
if( size.getSizeChange()==Note.NOTE_SIZE_SMALL_FACTOR )
{
node.setType(TagType.SIZE_SMALL);
}
else if( size.getSizeChange()==Note.NOTE_SIZE_LARGE_FACTOR )
{
node.setType(TagType.SIZE_LARGE);
}
else if( size.getSizeChange()==Note.NOTE_SIZE_HUGE_FACTOR )
{
node.setType(TagType.SIZE_HUGE);
}
}
else if( span instanceof LinkInternalSpan )
{
node.setType(TagType.LINK_INTERNAL);
}
else if( span instanceof LeadingMarginSpan.Standard )
{
LeadingMarginSpan.Standard margin = (LeadingMarginSpan.Standard) span;
int currentMargin = margin.getLeadingMargin(true);
node.setType(TagType.MARGIN);
node.listLevel = currentMargin / Note.NOTE_BULLET_INTENT_FACTOR;
}
else if( span instanceof BulletSpan )
{
node.setType(TagType.LIST_ITEM);
}
else {
node.setType(TagType.OTHER);
}
return node;
}