TextViewStyle.Builder

class TextViewStyle.Builder


Builder for the TextViewStyle.

Summary

Public constructors

Public functions

TextViewStyle

Returns a subclass of BundledStyle built by this builder.

B

Sets the background.

B

Sets the background color, it will always override the setBackground, regardless of which set method is call first.

B
setLayoutMargin(start: Int, top: Int, end: Int, bottom: Int)

Sets the layout margin through the view's layout param.

B
setPadding(start: Int, top: Int, end: Int, bottom: Int)

Sets the padding.

TextViewStyle.Builder
setTextColor(textColor: @ColorInt Int)

Specifies the text color.

TextViewStyle.Builder
setTextSize(textSize: Float)

Specifies the text size, in sp.

TextViewStyle.Builder
setTextSize(unit: Int, size: Float)

Specifies the text size in the provided unit.

TextViewStyle.Builder
setTypeface(fontFamily: String, fontStyle: Int)

Specifies the text font family and style.

Protected properties

Bundle

Public constructors

Builder

Added in 1.1.0
Builder()

Public functions

build

Added in 1.1.0
fun build(): TextViewStyle

Returns a subclass of BundledStyle built by this builder.

setBackground

Added in 1.1.0
fun setBackground(icon: Icon): B

Sets the background.

Parameters
icon: Icon

The icon to use as the background

setBackgroundColor

Added in 1.1.0
fun setBackgroundColor(color: @ColorInt Int): B

Sets the background color, it will always override the setBackground, regardless of which set method is call first.

Parameters
color: @ColorInt Int

the color of the background

setLayoutMargin

Added in 1.1.0
fun setLayoutMargin(start: Int, top: Int, end: Int, bottom: Int): B

Sets the layout margin through the view's layout param.

Note that the method takes start/end rather than left/right, respecting the layout direction.

Parameters
start: Int

the start margin size

top: Int

the top margin size

end: Int

the end margin size

bottom: Int

the bottom margin size

setPadding

Added in 1.1.0
fun setPadding(start: Int, top: Int, end: Int, bottom: Int): B

Sets the padding.

Note that the method takes start/end rather than left/right, respecting the layout direction.

Parameters
start: Int

the start padding in pixels

top: Int

the top padding in pixels

end: Int

the end padding in pixels

bottom: Int

the bottom padding in pixels

See also
setPadding

setTextColor

Added in 1.1.0
fun setTextColor(textColor: @ColorInt Int): TextViewStyle.Builder

Specifies the text color.

Parameters
textColor: @ColorInt Int

A color value in the form 0xAARRGGBB.

See also
setTextColor

setTextSize

Added in 1.1.0
fun setTextSize(textSize: Float): TextViewStyle.Builder

Specifies the text size, in sp.

Parameters
textSize: Float

The scaled pixel size.

See also
setTextSize

setTextSize

Added in 1.1.0
fun setTextSize(unit: Int, size: Float): TextViewStyle.Builder

Specifies the text size in the provided unit.

Parameters
unit: Int

The desired dimension unit.

size: Float

The device independent pixel size.

See also
setTextSize

setTypeface

Added in 1.1.0
fun setTypeface(fontFamily: String, fontStyle: Int): TextViewStyle.Builder

Specifies the text font family and style. If the font family can not be found/loaded from the renderer process, it may fallback to the default system font.

Parameters
fontFamily: String

the font family for the type face

fontStyle: Int

the style for the type face.

See also
create
setTypeface

Protected properties

mBundle

protected val mBundleBundle