Added in API level 37

Builder


class Builder
kotlin.Any
   ↳ android.app.permissionui.LocationButtonRequest.Builder

Builder for LocationButtonRequest.

Summary

Public constructors
Builder(width: Int, height: Int, configuration: Configuration)

Creates a new Builder with the required initial properties.

Public methods
LocationButtonRequest

Builds a LocationButtonRequest instance.

LocationButtonRequest.Builder
setBackgroundColor(backgroundColor: Int)

Sets the background color of the button.

LocationButtonRequest.Builder
setCornerRadius(cornerRadius: Float)

Sets the corner radius of the button.

LocationButtonRequest.Builder
setIconTint(iconTint: Int)

Sets the icon tint color.

LocationButtonRequest.Builder
setPaddingBottom(paddingBottom: Int)

Sets the bottom padding of the button.

LocationButtonRequest.Builder
setPaddingLeft(paddingLeft: Int)

Sets the left padding of the button.

LocationButtonRequest.Builder
setPaddingRight(paddingRight: Int)

Sets the right padding of the button.

LocationButtonRequest.Builder
setPaddingTop(paddingTop: Int)

Sets the top padding of the button.

LocationButtonRequest.Builder

Sets the corner radius of the button when pressed.

LocationButtonRequest.Builder
setStrokeColor(strokeColor: Int)

Sets the stroke color of the button.

LocationButtonRequest.Builder
setStrokeWidth(strokeWidth: Int)

Sets the stroke width of the button.

LocationButtonRequest.Builder
setTextColor(textColor: Int)

Sets the text color of the button.

LocationButtonRequest.Builder
setTextType(textType: Int)

Sets the text type of the button.

Public constructors

Builder

Added in API level 37
Builder(
    width: Int,
    height: Int,
    configuration: Configuration)

Creates a new Builder with the required initial properties.

The provided width must be at least 48dp. The provided height must be between 48dp and 136dp (inclusive). Values outside these ranges will be clamped by the system during session creation and resizing.

Parameters
width Int: The total width of the button in pixels.
height Int: The total height of the button in pixels.
configuration Configuration: The Configuration of the context hosting the button.
This value cannot be null.

Public methods

build

Added in API level 37
fun build(): LocationButtonRequest

Builds a LocationButtonRequest instance.

Return
LocationButtonRequest This value cannot be null.

setBackgroundColor

Added in API level 37
fun setBackgroundColor(backgroundColor: Int): LocationButtonRequest.Builder

Sets the background color of the button.

The system will ensure the background color is fully opaque by overriding its alpha channel to 255. If not explicitly set, it defaults to a system default color.

Return
LocationButtonRequest.Builder This value cannot be null.

setCornerRadius

Added in API level 37
fun setCornerRadius(cornerRadius: Float): LocationButtonRequest.Builder

Sets the corner radius of the button.

The corner radius must be non-negative. Negative values will be clamped to 0.

Return
LocationButtonRequest.Builder This value cannot be null.

setIconTint

Added in API level 37
fun setIconTint(iconTint: Int): LocationButtonRequest.Builder

Sets the icon tint color.

The system will automatically adjust the provided color if necessary to ensure it meets a minimum contrast ratio of 4.5:1 against the button's background color. If not explicitly set, it defaults to a system default color.

Return
LocationButtonRequest.Builder This value cannot be null.

setPaddingBottom

Added in API level 37
fun setPaddingBottom(paddingBottom: Int): LocationButtonRequest.Builder

Sets the bottom padding of the button.

The padding must be between 0 and 8dp (inclusive). Values outside this range will be clamped. If not explicitly set, it defaults to 0.

Return
LocationButtonRequest.Builder This value cannot be null.

setPaddingLeft

Added in API level 37
fun setPaddingLeft(paddingLeft: Int): LocationButtonRequest.Builder

Sets the left padding of the button.

The padding must be between 0 and 8dp (inclusive). Values outside this range will be clamped. If not explicitly set, it defaults to 0.

Return
LocationButtonRequest.Builder This value cannot be null.

setPaddingRight

Added in API level 37
fun setPaddingRight(paddingRight: Int): LocationButtonRequest.Builder

Sets the right padding of the button.

The padding must be between 0 and 8dp (inclusive). Values outside this range will be clamped. If not explicitly set, it defaults to 0.

Return
LocationButtonRequest.Builder This value cannot be null.

setPaddingTop

Added in API level 37
fun setPaddingTop(paddingTop: Int): LocationButtonRequest.Builder

Sets the top padding of the button.

The padding must be between 0 and 8dp (inclusive). Values outside this range will be clamped. If not explicitly set, it defaults to 0.

Return
LocationButtonRequest.Builder This value cannot be null.

setPressedCornerRadius

Added in API level 37
fun setPressedCornerRadius(cornerRadius: Float): LocationButtonRequest.Builder

Sets the corner radius of the button when pressed.

The corner radius must be non-negative. Negative values will be clamped to 0.

Return
LocationButtonRequest.Builder This value cannot be null.

setStrokeColor

Added in API level 37
fun setStrokeColor(strokeColor: Int): LocationButtonRequest.Builder

Sets the stroke color of the button.

If not explicitly set, the stroke color will default to the button's background color.

Return
LocationButtonRequest.Builder This value cannot be null.

setStrokeWidth

Added in API level 37
fun setStrokeWidth(strokeWidth: Int): LocationButtonRequest.Builder

Sets the stroke width of the button.

The stroke width must be between 0 and 3dp (inclusive). Values outside this range will be clamped. If not explicitly set, it defaults to 0.

Return
LocationButtonRequest.Builder This value cannot be null.

setTextColor

Added in API level 37
fun setTextColor(textColor: Int): LocationButtonRequest.Builder

Sets the text color of the button.

The system will automatically adjust the provided color if necessary to ensure it meets a minimum contrast ratio of 4.5:1 against the button's background color. If not explicitly set, it defaults to a system default color.

Return
LocationButtonRequest.Builder This value cannot be null.