|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.text.span.BitmapSpan
public class BitmapSpan
This implementation of DrawnSpan draws a Bitmap instead of text. You should take care to ensure that the span is exclusive on both ends to guard against it accidentally growing to cover text inserted nearby.
In general you will want to cover exactly one character with a BitmapSpan. You are encouraged to use character FFFC (the Unicode "Object Replacement Character") in the underlying text.
You may instead prefer to place the "alt" text for the image
in the buffer and cover that text with the bitmap. This is
what happens with the IM smilies. If you do this, be careful
not to include any carriage returns or line feeds in the
underlying text because it may fool the text rewrapping code
into thinking that a new paragraph starts in the middle of
your bitmap. Because BitmapSpan is an AtomicSpan,
EditText will take care to keep the user from moving the cursor
into the middle of your underlying text or making changes to it
other than as a unit.
| Field Summary | |
|---|---|
static int |
ALIGN_ABOVE
Align with respect to the bottom of the bitmap. |
static int |
ALIGN_BELOW
Align with respect to the top of the bitmap. |
static int |
ALIGN_CENTER
Align with respect to the center of the bitmap. |
static Class |
BITMAP_SPAN_TYPE
|
static int |
RELATIVE_TO_ASCENT
Align with respect to the top of the ascent of the font. |
static int |
RELATIVE_TO_BASELINE
Align with respect to the baseline of the font. |
static int |
RELATIVE_TO_BODY_CENTER
Align with respect to the center of the body of the font. |
static int |
RELATIVE_TO_DESCENT
Align with respect to the bottom of the descent of the font. |
| Fields inherited from interface danger.text.span.CharacterHeightAffectingSpan |
|---|
CHARACTER_HEIGHT_AFFECTING_SPAN_TYPE |
| Constructor Summary | |
|---|---|
BitmapSpan(Bitmap b,
int alignment,
int relativeTo)
Create a BitmapSpan with the specified bitmap and alignment. |
|
| Method Summary | |
|---|---|
int |
drawText(Pen p,
CharSequence text,
int start,
int len,
int x,
int top,
int baseline,
int bottom,
Object[] spans)
Claim to be drawing a segment of text but actually draw a Bitmap. |
boolean |
findLineBreakCandidate(Font f,
int wid_avail,
CharSequence text,
int end,
LineBreakerArguments args,
Object[] spans)
Find a line break within this BitmapSpan. |
int |
getAdvance(Font f,
CharSequence text,
int offset,
int len,
Object[] spans)
Claim that the advance of this text is actually the width of the bitmap. |
int |
getAlignment()
|
Bitmap |
getBitmap()
|
int |
getRelativeTo()
|
int |
getVerticalDimensions(Font f,
CharSequence text,
int start,
int end,
Object[] spans)
Return the vertical space occupied by this bitmap, taking into account its vertical alignment and what it is aligned relative to. |
int |
getWidth(Font f,
CharSequence text,
int start,
int len,
Object[] spans)
Claim that the width of this text is actually the width of the bitmap. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Class BITMAP_SPAN_TYPE
public static final int ALIGN_ABOVE
public static final int ALIGN_CENTER
public static final int ALIGN_BELOW
public static final int RELATIVE_TO_ASCENT
public static final int RELATIVE_TO_BASELINE
public static final int RELATIVE_TO_DESCENT
public static final int RELATIVE_TO_BODY_CENTER
| Constructor Detail |
|---|
public BitmapSpan(Bitmap b,
int alignment,
int relativeTo)
| Method Detail |
|---|
public Bitmap getBitmap()
public int getAlignment()
public int getRelativeTo()
public int drawText(Pen p,
CharSequence text,
int start,
int len,
int x,
int top,
int baseline,
int bottom,
Object[] spans)
drawText in interface DrawnSpan
public int getWidth(Font f,
CharSequence text,
int start,
int len,
Object[] spans)
getWidth in interface DrawnSpan
public int getAdvance(Font f,
CharSequence text,
int offset,
int len,
Object[] spans)
getAdvance in interface DrawnSpan
public int getVerticalDimensions(Font f,
CharSequence text,
int start,
int end,
Object[] spans)
getVerticalDimensions in interface DrawnSpan
public boolean findLineBreakCandidate(Font f,
int wid_avail,
CharSequence text,
int end,
LineBreakerArguments args,
Object[] spans)
findLineBreakCandidate in interface DrawnSpan
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||