CustomToggleButton
This Project let you create the custom toggleButton with beautiful animation in a simplest way
Install / Use
/learn @sparrow007/CustomToggleButtonREADME
CustomToggleButton in Android
This Project let you create the custom toggleButton with beautiful animation in a simplest way

USAGE
To make a Custom ToggleButton add CustomToggle in your layout XML and add CustomToggleButton library in your project or you can also grab it through Gradle:
Gradle
dependencies {
...
implementation 'com.jackandphantom.android:customtogglebutton:1.0.1'
}
XML
<!-- <a> custom togglebutton xml</a> -->
<com.jackandphantom.customtogglebutton.CustomToggle
android:layout_width="275dp"
android:layout_height="100dp"
app:ctg_addLeftIcon="@drawable/ic_left_icon"
app:ctg_addRightIcon="@drawable/ic_right_icon"
app:ctg_addSlideColor="#ff67"
app:ctg_addSlideBackgroundColor="#6c817a"
app:ctg_addAnimationType="jack_animation"
/>
NOTE
You should use vector drawable icon in ctg_addLeftIcon and ctg_addRightIcon attribute.
PROPERTIES
You may use the following properties in your XML to change your CustomToggleButton.
/* circular progressbar xml */
- app:ctg_addLeftIcon (Drawable) --> default NULL
- app:ctg_addRightIcon (Drawable) --> default NULL
- app:ctg_addMagnification (Integer) --> default 8
- app:ctg_addSlideColor (Color) --> default BLUE
- app:ctg_addSlideBackgroundColor (Color) --> default LTGRAY
- app:ctg_addAnimationType (Enum) --> default jack_animation
- app:ctg_addAnimationTime (Integer) --> default 600
JAVA
CustomToggle customToggle = (CustomToggle) findViewById(R.id.custom);
customToggle.addFirstIcon(firstIconDrawable);
customToggle.addSecondIcon(secondIconDrawable);
customToggle.setMagnification(9);
customToggle.setSlideBackgroundColor(Color.BLACK);
customToggle.setAnimationTime(700);
customToggle.setSlideColor(Color.GREEN);
customToggle.setOnToggleClickListener(new CustomToggle.OnToggleClickListener() {
@Override
public void onLefToggleEnabled(boolean enabled) {
}
@Override
public void onRightToggleEnabled(boolean enabled) {
}
});
- There is also the getter method you can call them as per your requirements.
LICENCE
Copyright 2017 Ankit kumar
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.
Thanks to Vitaly Rubtsov
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
