Example usage for Java android.text TextPaint fields, constructors, methods, implement or subclass
The text is from its open source code.
float | ascent() Return the distance above (negative) the baseline (ascent) based on the current typeface and text size. |
int | breakText(CharSequence text, int start, int end, boolean measureForwards, float maxWidth, float[] measuredWidth) Measure the text, stopping early if the measured width exceeds maxWidth. |
int | breakText(String text, boolean measureForwards, float maxWidth, float[] measuredWidth) Measure the text, stopping early if the measured width exceeds maxWidth. |
float | descent() Return the distance below (positive) the baseline (descent) based on the current typeface and text size. |
int | getColor() Return the paint's color. |
int | getFlags() Return the paint's flags. |
FontMetrics | getFontMetrics() Allocates a new FontMetrics object, and then calls getFontMetrics(fm) with it, returning the object. |
int | getFontMetricsInt(FontMetricsInt fmi) Return the font's interline spacing, given the Paint's settings for typeface, textSize, etc. |
FontMetricsInt | getFontMetricsInt() |
Align | getTextAlign() Return the paint's Align value for drawing text. |
void | getTextBounds(String text, int start, int end, Rect bounds) Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0). |
float | getTextSize() Return the paint's text size. |
int | getTextWidths(char[] text, int index, int count, float[] widths) Return the advance widths for the characters in the string. |
int | getTextWidths(String text, float[] widths) Return the advance widths for the characters in the string. |
Typeface | getTypeface() Get the paint's typeface object. |
float | measureText(String text) Return the width of the text. |
float | measureText(char[] text, int index, int count) Return the width of the text. |
void | setAntiAlias(boolean aa) Helper for setFlags(), setting or clearing the ANTI_ALIAS_FLAG bit AntiAliasing smooths out the edges of what is being drawn, but is has no impact on the interior of the shape. |
void | setColor(@ColorInt int color) Set the paint's color. |
void | setFakeBoldText(boolean fakeBoldText) Helper for setFlags(), setting or clearing the FAKE_BOLD_TEXT_FLAG bit |
void | setFlags(int flags) Set the paint's flags. |
void | setLetterSpacing(float letterSpacing) Set the paint's letter-spacing for text. |
void | setLinearText(boolean linearText) Helper for setFlags(), setting or clearing the LINEAR_TEXT_FLAG bit |
Shader | setShader(Shader shader) Set or clear the shader object. |
void | setShadowLayer(float radius, float dx, float dy, int shadowColor) This draws a shadow layer below the main layer, with the specified offset and color, and blur radius. |
void | setStyle(Style style) Set the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes Fill). |
void | setTextAlign(Align align) Set the paint's text alignment. |
void | setTextScaleX(float scaleX) Set the paint's horizontal scale factor for text. |
void | setTextSize(float textSize) Set the paint's text size. |
Typeface | setTypeface(Typeface typeface) Set or clear the typeface object. |
void | setUnderlineText(boolean underlineText) Helper for setFlags(), setting or clearing the UNDERLINE_TEXT_FLAG bit |