android-components / mozilla.components.concept.toolbar / Toolbar / ActionToggleButton / <init>

# <init>

`ActionToggleButton(@DrawableRes imageResource: Int, @DrawableRes imageResourceSelected: Int, contentDescription: String, contentDescriptionSelected: String, visible: () -> Boolean = { true }, selected: Boolean = false, @DrawableRes background: Int? = null, padding: Padding? = null, listener: (Boolean) -> Unit = {})`

An action button with two states, selected and unselected. When the button is pressed, the state changes automatically.

### Parameters

`imageResource` - The drawable to be shown if the button is in unselected state.

`imageResourceSelected` - The drawable to be shown if the button is in selected state.

`contentDescription` - The content description to use if the button is in unselected state.

`contentDescriptionSelected` - The content description to use if the button is in selected state.

`visible` - Lambda that returns true or false to indicate whether this button should be shown.

`selected` - Sets whether this button should be selected initially.

`background` - A custom (stateful) background drawable resource to be used.

`padding` - A optional custom padding.

`listener` - Callback that will be invoked whenever the checked state changes.