← Back to Glance AppWidget
CheckBox
Overview
Examples
Community Notes
Video
Adds a check box view to the glance view.
@param checked whether the check box is checked @param onCheckedChange the action to be run when the checkbox is clicked. The current value of checked is provided to this action in its ActionParameters, and can be retrieved using the ToggleableStateKey. If this action launches an activity, the current value of checked will be passed as an intent extra with the name RemoteViews.EXTRA_CHECKED. @param modifier the modifier to apply to the check box @param text the text to display to the end of the check box @param style the style to apply to text @param colors the color tint to apply to the check box @param maxLines An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated.
Overloads
CheckBox
@Composable
fun CheckBox(
checked: Boolean,
onCheckedChange: Action?,
modifier: GlanceModifier = GlanceModifier,
text: String = "",
style: TextStyle? = null,
colors: CheckBoxColors = CheckBoxColors(),
maxLines: Int = Int.MAX_VALUE,
)
Parameters
Name | Description |
---|---|
checked | whether the check box is checked |
onCheckedChange | the action to be run when the checkbox is clicked. The current value of checked is provided to this action in its ActionParameters, and can be retrieved using the ToggleableStateKey. If this action launches an activity, the current value of checked will be passed as an intent extra with the name RemoteViews.EXTRA_CHECKED. |
modifier | the modifier to apply to the check box |
text | the text to display to the end of the check box |
style | the style to apply to text |
colors | the color tint to apply to the check box |
maxLines | An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated |