ImageViewStyle.Builder

public final class ImageViewStyle.Builder


Builder for the ImageViewStyle.

Summary

Protected fields

final @NonNull Bundle

Public constructors

Public methods

@NonNull ImageViewStyle

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 ImageViewStyle.Builder
setMaxHeight(int maxHeight)

Sets a maximum height for the image view.

@NonNull ImageViewStyle.Builder
setMaxWidth(int maxWidth)

Sets a maximum width for the image view.

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

Sets the padding.

@NonNull ImageViewStyle.Builder

Sets the scale type of the image view.

@NonNull ImageViewStyle.Builder

Sets a tint color to the image view.

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 ImageViewStyle 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

setMaxHeight

Added in 1.1.0
public @NonNull ImageViewStyle.Builder setMaxHeight(int maxHeight)

Sets a maximum height for the image view.

Parameters
int maxHeight

maximum height for this view

See also
setMaxHeight

setMaxWidth

Added in 1.1.0
public @NonNull ImageViewStyle.Builder setMaxWidth(int maxWidth)

Sets a maximum width for the image view.

Parameters
int maxWidth

maximum width for this view

See also
setMaxWidth

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

setScaleType

Added in 1.1.0
public @NonNull ImageViewStyle.Builder setScaleType(@NonNull ImageView.ScaleType scaleType)

Sets the scale type of the image view.

Parameters
@NonNull ImageView.ScaleType scaleType

The desired scaling mode.

See also
setScaleType

setTintList

Added in 1.1.0
public @NonNull ImageViewStyle.Builder setTintList(@NonNull ColorStateList imageTintList)

Sets a tint color to the image view.

Parameters
@NonNull ColorStateList imageTintList

the tint color to apply to the image

See also
setImageTintList