https://github.com/mmj-dev-git/toogleswitch
https://github.com/mmj-dev-git/toogleswitch
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mmj-dev-git/toogleswitch
- Owner: mmj-dev-git
- Created: 2021-03-02T07:56:19.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-02T07:57:22.000Z (almost 5 years ago)
- Last Synced: 2025-07-01T11:55:00.191Z (5 months ago)
- Language: Java
- Size: 453 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ToggleSwitchButton
This project aims to provide a working dual toggle button implementation.
[](http://android-arsenal.com/details/1/2439)

#Usage
*For a working implementation, Have a look at the Sample Project - app*
1. Include the library as local library project:
``` groovy
compile 'co.aenterhy:toggleswitch:1.0.0'
```
2. Add view to your layout file:
``` xml
```
3. Add to your ```styles.xml```:
``` xml
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_alignParentBottom">true</item>
<item name="android:layout_alignParentRight">true</item>
<item name="outerRadius">50dp</item>
<item name="handleDrawable">@drawable/ic_switch</item>
<item name="upper">@drawable/ic_camera</item>
<item name="bottom">@drawable/ic_audio</item>
```
4. Add component handler into your activity or fragment:
``` java
toggle = (ToggleSwitchButton) findViewById(R.id.toggle);
toggle.setOnTriggerListener(new ToggleSwitchButton.OnTriggerListener() {
@Override
public void toggledUp() {
Toast.makeText(MainActivity.this, "Camera", Toast.LENGTH_SHORT).show();
}
@Override
public void toggledDown() {
Toast.makeText(MainActivity.this, "Audio", Toast.LENGTH_SHORT).show();
}
});
```
More options will be added soon :)
#Compatibility
* Android 4.0+
# Changelog
### Version: 1.0
* Initial Build
## License
Copyright 2015, Roman Herasymenko
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.