TextViewStyle.Builder


public final class TextViewStyle.Builder


Builder for the TextViewStyle.

Summary

Public constructors

Public methods

@NonNull TextViewStyle

Returns a subclass of BundledStyle built by this builder.

@NonNull TextViewStyle.Builder
setTextColor(@ColorInt int textColor)

Specifies the text color.

@NonNull TextViewStyle.Builder
setTextSize(float textSize)

Specifies the text size, in sp.

@NonNull TextViewStyle.Builder
setTextSize(int unit, float size)

Specifies the text size in the provided unit.

@NonNull TextViewStyle.Builder
setTypeface(@NonNull String fontFamily, int fontStyle)

Specifies the text font family and style.

Public constructors

Builder

Added in 1.1.0
public Builder()

Public methods

build

Added in 1.1.0
public @NonNull TextViewStyle build()

Returns a subclass of BundledStyle built by this builder.

setTextColor

Added in 1.1.0
public @NonNull TextViewStyle.Builder setTextColor(@ColorInt int textColor)

Specifies the text color.

Parameters
@ColorInt int textColor

A color value in the form 0xAARRGGBB.

See also
setTextColor

setTextSize

Added in 1.1.0
public @NonNull TextViewStyle.Builder setTextSize(float textSize)

Specifies the text size, in sp.

Parameters
float textSize

The scaled pixel size.

See also
setTextSize

setTextSize

Added in 1.1.0
public @NonNull TextViewStyle.Builder setTextSize(int unit, float size)

Specifies the text size in the provided unit.

Parameters
int unit

The desired dimension unit.

float size

The device independent pixel size.

See also
setTextSize

setTypeface

Added in 1.1.0
public @NonNull TextViewStyle.Builder setTypeface(@NonNull String fontFamily, int fontStyle)

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
@NonNull String fontFamily

the font family for the type face

int fontStyle

the style for the type face.

See also
create
setTypeface