TextViewStyle.Builder
public
static
final
class
TextViewStyle.Builder
extends Object
java.lang.Object | |
↳ | androidx.autofill.inline.common.TextViewStyle.Builder |
Builder for the TextViewStyle
.
Summary
Fields | |
---|---|
protected
final
Bundle |
mBundle
|
Public constructors | |
---|---|
Builder()
|
Public methods | |
---|---|
TextViewStyle
|
build()
Returns a subclass of BundledStyle built by this builder. |
B extends BaseBuilder<T extends ViewStyle, B>
|
setBackground(Icon icon)
Sets the background. |
B extends BaseBuilder<T extends ViewStyle, B>
|
setBackgroundColor(int color)
Sets the background color, it will always override the |
B extends BaseBuilder<T extends ViewStyle, B>
|
setLayoutMargin(int start, int top, int end, int bottom)
Sets the layout margin through the view's layout param. |
B extends BaseBuilder<T extends ViewStyle, B>
|
setPadding(int start, int top, int end, int bottom)
Sets the padding. |
TextViewStyle.Builder
|
setTextColor(int textColor)
Specifies the text color. |
TextViewStyle.Builder
|
setTextSize(float textSize)
Specifies the text size, in sp. |
TextViewStyle.Builder
|
setTextSize(int unit, float size)
Specifies the text size in the provided unit. |
TextViewStyle.Builder
|
setTypeface(String fontFamily, int fontStyle)
Specifies the text font family and style. |
Protected methods | |
---|---|
abstract
B extends BaseBuilder<T extends ViewStyle, B>
|
getThis()
Returns |
Inherited methods | |
---|---|
Fields
Public constructors
Builder
public Builder ()
Public methods
build
public TextViewStyle build ()
Returns a subclass of BundledStyle built by this builder.
Returns | |
---|---|
TextViewStyle |
setBackground
public B extends BaseBuilder<T extends ViewStyle, B> setBackground (Icon icon)
Sets the background.
Parameters | |
---|---|
icon |
Icon : The icon to use as the background |
Returns | |
---|---|
B extends BaseBuilder<T extends ViewStyle, B> |
setBackgroundColor
public B extends BaseBuilder<T extends ViewStyle, B> setBackgroundColor (int color)
Sets the background color, it will always override the setBackground(Icon)
,
regardless of which set method is call first.
Parameters | |
---|---|
color |
int : the color of the background |
Returns | |
---|---|
B extends BaseBuilder<T extends ViewStyle, B> |
See also:
setLayoutMargin
public B extends BaseBuilder<T extends ViewStyle, B> setLayoutMargin (int start, int top, int end, int bottom)
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 |
Returns | |
---|---|
B extends BaseBuilder<T extends ViewStyle, B> |
setPadding
public B extends BaseBuilder<T extends ViewStyle, B> setPadding (int start, int top, int end, int bottom)
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 |
Returns | |
---|---|
B extends BaseBuilder<T extends ViewStyle, B> |
See also:
setTextColor
public TextViewStyle.Builder setTextColor (int textColor)
Specifies the text color.
Parameters | |
---|---|
textColor |
int : A color value in the form 0xAARRGGBB. |
Returns | |
---|---|
TextViewStyle.Builder |
See also:
setTextSize
public TextViewStyle.Builder setTextSize (float textSize)
Specifies the text size, in sp.
Parameters | |
---|---|
textSize |
float : The scaled pixel size. |
Returns | |
---|---|
TextViewStyle.Builder |
See also:
setTextSize
public TextViewStyle.Builder setTextSize (int unit, float size)
Specifies the text size in the provided unit.
Parameters | |
---|---|
unit |
int : The desired dimension unit. |
size |
float : The device independent pixel size. |
Returns | |
---|---|
TextViewStyle.Builder |
See also:
setTypeface
public TextViewStyle.Builder setTypeface (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 | |
---|---|
fontFamily |
String : the font family for the type face |
fontStyle |
int : the style for the type face. |
Returns | |
---|---|
TextViewStyle.Builder |
Protected methods
getThis
protected abstract B extends BaseBuilder<T extends ViewStyle, B> getThis ()
Returns this
with the actual type of the subclass, so the setter methods can
be chained.
Returns | |
---|---|
B extends BaseBuilder<T extends ViewStyle, B> |