public static final class TextStyle.Builder extends Object implements AutoCloseable
Constructor and Description |
---|
Builder(TextStyle.Builder other) |
Modifier and Type | Method and Description |
---|---|
TextStyle |
build()
Creates a newly created text style, based on the properties set on this builder.
|
void |
close() |
protected void |
finalize() |
TextStyle.Builder |
fontName(String fontName)
Sets the font name used for text rendering (possible values: Serif, Sans, Arial, Arial Black, Arial Narrow, Calibri, Console, Noto).
|
TextStyle.Builder |
fontSize(long fontSize)
Sets the font size in pixels , where a pixel is defined as 1/96th of 1 inch (https://www.w3.org/TR/css-values-4/#absolute-lengths).
|
TextStyle.Builder |
haloColor(android.graphics.Color haloColor)
Sets the color of the halo (outline) around the text.
|
TextStyle.Builder |
haloWidth(double haloWidth)
Sets the width of the halo (outline) around the text in pixels.
|
TextStyle.Builder |
textColor(android.graphics.Color textColor)
Sets the text color.
|
public Builder(@NotNull TextStyle.Builder other)
public void close()
close
in interface AutoCloseable
@NotNull public TextStyle build()
@NotNull public TextStyle.Builder fontName(@NotNull String fontName)
If not specified, then the Serif font will be used to display text. The Noto font has support for the following alphabets: Arabic, Armenian, Bengali, Cyrillic, Devanagari, Georgian, Greek, Gujarati, Gurmukhi, Hangul, Han, Hebrew, Hiragana, Kanji, Kannada, Katakana, Lao, Latin, Malayalam, Oriya, Tamil, Telugu and Thai. Other fonts only support Latin alphabets.
fontName
- identifier of the font used for text rendering.@NotNull public TextStyle.Builder fontSize(long fontSize)
The font size value must be > 0. If not specified, a size of 14 is used.
fontSize
- the font size in pixels, where a pixel is defined as 1/96th of 1 inch.@NotNull public TextStyle.Builder textColor(@NotNull android.graphics.Color textColor)
By default, this is black.
textColor
- The text color.@NotNull public TextStyle.Builder haloWidth(double haloWidth)
This value must be greater then or equal to zero. If this value is equal to zero, no halo is drawn. Text halo width is 1 pixel wide by default.
haloWidth
- the size of the halo (outline) around text in pixels.@NotNull public TextStyle.Builder haloColor(@NotNull android.graphics.Color haloColor)
The default value is white.
haloColor
- the color of the halo (outline) around the text.