Skip to content

A segmented control for Android, similar to the iOS UISegmentedControl.

License

Notifications You must be signed in to change notification settings

nairteashop/SegmentedControl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SegmentedControl

SegmentedControl is a holo-themed, touch-friendly alternative to the radio control in Android. This control is similar to UISegmentedControl in iOS.

SegmentedControl

Installation

  • Clone or download the repository
  • Import the SegmentedControl/SegmentedControl library project into the Android IDE
  • Go to your project's properties and add SegmentedControl as a library
  • Open your project's styles.xml file and add an entry for segmentedControlButtonStyle as shown below:
<style name="AppTheme" parent="...">
    ...
    <item name="segmentedControlButtonStyle">@style/SegmentedControlButton</item>
</style>

(This last step is necessary due to Android issue 12683.)

Usage

SegmentedControl can be used as a drop-in replacement for RadioGroup.

Sample layout XML:

<org.nairteashop.SegmentedControl
    android:id="@+id/segmented_control"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
>
    <org.nairteashop.SegmentedControlButton android:id="@+id/opt_1" android:text="@string/label_1" />
    <org.nairteashop.SegmentedControlButton android:id="@+id/opt_2" android:text="@string/label_2" />
</org.nairteashop.SegmentedControl>

Credits

SegmentedControl was created by Arun Nair, based on code by Benjamin Ferrari. If you use this code in your project, attribution is appreciated.

About

A segmented control for Android, similar to the iOS UISegmentedControl.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages