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

ImageViewStyle.Builder

public static final class ImageViewStyle.Builder
extends Object

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


Builder for the ImageViewStyle.

Summary

Fields

protected final Bundle mBundle

Public constructors

Builder()

Public methods

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

ImageViewStyle.Builder setMaxHeight(int maxHeight)

Sets a maximum height for the image view.

ImageViewStyle.Builder setMaxWidth(int maxWidth)

Sets a maximum width for the image view.

B extends BaseBuilder<T extends ViewStyle, B> setPadding(int start, int top, int end, int bottom)

Sets the padding.

ImageViewStyle.Builder setScaleType(ImageView.ScaleType scaleType)

Sets the scale type of the image view.

ImageViewStyle.Builder setTintList(ColorStateList imageTintList)

Sets a tint color to the image view.

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 ImageViewStyle build ()

Returns a subclass of BundledStyle built by this builder.

Returns
ImageViewStyle

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>

setMaxHeight

public ImageViewStyle.Builder setMaxHeight (int maxHeight)

Sets a maximum height for the image view.

Parameters
maxHeight int: maximum height for this view

Returns
ImageViewStyle.Builder

setMaxWidth

public ImageViewStyle.Builder setMaxWidth (int maxWidth)

Sets a maximum width for the image view.

Parameters
maxWidth int: maximum width for this view

Returns
ImageViewStyle.Builder

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>

setScaleType

public ImageViewStyle.Builder setScaleType (ImageView.ScaleType scaleType)

Sets the scale type of the image view.

Parameters
scaleType ImageView.ScaleType: The desired scaling mode.

Returns
ImageViewStyle.Builder

setTintList

public ImageViewStyle.Builder setTintList (ColorStateList imageTintList)

Sets a tint color to the image view.

Parameters
imageTintList ColorStateList: the tint color to apply to the image

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