Google is committed to advancing racial equity for Black communities. See how.

ViewStyle.Builder

public static final class ViewStyle.Builder
extends Object

java.lang.Object
   ↳ androidx.autofill.inline.common.ViewStyle.Builder


Builder for the ViewStyle.

Summary

Fields

protected final Bundle mBundle

Public constructors

Builder()

Public methods

ViewStyle 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 setBackground(Icon), regardless of which set method is call first.

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.

Protected methods

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.

Inherited methods

Fields

mBundle

protected final Bundle mBundle

Public constructors

Builder

public Builder ()

Public methods

build

public ViewStyle build ()

Returns a subclass of BundledStyle built by this builder.

Returns
ViewStyle

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>

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>

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>