This library adds two custom widgets that adhere to the Material Design definition for toggle buttons. Library is backwards compatible to API 9.
You can add the library with:
compile 'com.anthonymandra:ToggleButtons:2.0.0'
Version 2.0 adds backwards compatibility to API 9. This changed the api for dividers slightly.
- Divider is now in the custom namespace:
app:divider
- Divider can no longer support tint. You'll need to create custom drawbles.
You can use ToggleGroup
much like you would a RadioGroup
and fill it with ToggleButton
, or anything extending CompoundButton
. See the Sample for examples.
When no text is present they will use a custom draw that allows proper image alignment. When text is present they will behave like a traditional CompoundButton
, or the old android ToggleButton
.
You can toggle exclusive selection or multi selection on a group and you can also allow unselecting (no selection at all). Buttons support tint.