ViewStyle.Builder

public final class ViewStyle.Builder


Builder for the ViewStyle.

Summary

Protected fields

final @NonNull Bundle

Public constructors

Public methods

@NonNull ViewStyle

Returns a subclass of BundledStyle built by this builder.

@NonNull B

Sets the background.

@NonNull B

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

@NonNull B
setLayoutMargin(int start, int top, int end, int bottom)

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

@NonNull B
setPadding(int start, int top, int end, int bottom)

Sets the padding.

Protected fields

mBundle

protected final @NonNull Bundle mBundle

Public constructors

Builder

Added in 1.1.0
public Builder()

Public methods

build

Added in 1.1.0
public @NonNull ViewStyle build()

Returns a subclass of BundledStyle built by this builder.

setBackground

Added in 1.1.0
public @NonNullsetBackground(@NonNull Icon icon)

Sets the background.

Parameters
@NonNull Icon icon

The icon to use as the background

setBackgroundColor

Added in 1.1.0
public @NonNullsetBackgroundColor(@ColorInt int color)

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

Parameters
@ColorInt int color

the color of the background

setLayoutMargin

Added in 1.1.0
public @NonNullsetLayoutMargin(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
int start

the start margin size

int top

the top margin size

int end

the end margin size

int bottom

the bottom margin size

setPadding

Added in 1.1.0
public @NonNullsetPadding(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
int start

the start padding in pixels

int top

the top padding in pixels

int end

the end padding in pixels

int bottom

the bottom padding in pixels

See also
setPadding