SkillAgentSearch skills...

ToggleButtons

Android toggle buttons that adhere to the Material Design documentation.

Install / Use

/learn @rcketscientist/ToggleButtons
About this skill

Quality Score

0/100

Category

Design

Supported Platforms

Universal

README

Google finally released an official version:

MaterialButtonToggleGroup

I recommend using this instead unless a deficiency is found.

Download license

ToggleButtons

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:3.0.1'

Recent Changes

Version 3.0

Migrate to androidx. Required a bump to minSdk 14.

  1. Package name changed to androidx.appcompat.widget. ToggleButton|ToggleGroup

Version 2.0

Adds backwards compatibility to API 9. This changed the api for dividers slightly.

  1. Divider is now in the custom namespace: app:divider
  2. Divider can no longer support tint. You'll need to create custom drawbles.

Basics

You can use <code>ToggleGroup</code> much like you would a <code>RadioGroup</code> and fill it with <code>ToggleButton</code>, or anything extending <code>CompoundButton</code>. 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 <code>CompoundButton</code>, or the old android <code>ToggleButton</code>.

image

You can toggle exclusive selection or multi selection on a group and you can also allow unselecting (no selection at all). Buttons support tint.

Sample

screenshot_1500045520

Official Material Guidelines

materialtoggle

Related Skills

View on GitHub
GitHub Stars91
CategoryDesign
Updated1y ago
Forks11

Languages

Java

Security Score

85/100

Audited on Mar 12, 2025

No findings