ViewStyle.Builder

class ViewStyle.Builder


Builder for the ViewStyle.

Summary

Public constructors

Public functions

ViewStyle

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.

Protected properties

Bundle

Public constructors

Builder

Added in 1.1.0
Builder()

Public functions

build

Added in 1.1.0
fun build(): ViewStyle

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

Protected properties

mBundle

protected val mBundleBundle