ToggleButton Widget For Android Dev

Related tags

Button ToggleButton
Overview

ToggleButton

ToggleButton Widget For Android Developers

@Deprecated
!!!项目已经停止维护,新项目移至https://github.com/zcweng/SwitchButton !!!

How To Use

        xmlns:toggle="http://schemas.android.com/apk/res-auto"


        <com.zcw.togglebutton.ToggleButton
            android:layout_width="54dp"
            toggle:tbOnColor="#f00"
            toggle:tbOffColor="#ddd"
            toggle:tbSpotColor="#00f"
            toggle:tbOffBorderColor="#000"
            toggle:tbBorderWidth="2dp"
            android:layout_height="30dp" >
        </com.zcw.togglebutton.ToggleButton>
        ToggleButton toggleBtn;
        
        //切换开关
        toggleBtn.toggle();
        //切换无动画
        toggleBtn.toggle(false);
        //开关切换事件
        toggleBtn.setOnToggleChanged(new OnToggleChanged(){
                @Override
                public void onToggle(boolean on) {
                }
        });
        
        toggleBtn.setToggleOn();
        toggleBtn.setToggleOff();
        //无动画切换
        toggleBtn.setToggleOn(false);
        toggleBtn.setToggleOff(false);
        
        //禁用动画
        toggleBtn.setAnimate(false);

Default Size:width=50dp,height=30dp.

引用方式

2016/8/3 17:04:53 
compile 'com.zcw:togglebutton-library:1.0.0'
Comments
  • ToggleButton loses sliding animation when

    ToggleButton loses sliding animation when "included" in a layout

    I created a layout to contain the ToggleButton, then I created another layout and use "include" mark to quote the layout, which contains the ToggleButton.

    I ran the app with the second layout, and found ToggleButton had no sliding animation effects.

    For example:

    First xml: layout1.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:toggle="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
    
        <com.zcw.togglebutton.ToggleButton
            android:id="@+id/switcher"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
        </com.zcw.togglebutton.ToggleButton>
    
    </RelativeLayout>
    

    Second xml: layout2.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:toggle="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
    
        <include layout="@layout/layout1" />
    
    </RelativeLayout>
    
    opened by MewX 2
  • 项目整理

    项目整理

    本次PR主要是对项目的整理,修改如下: 1,把项目结构迁移为Android Gradle 项目结构的布局。使用约定的目录可以减少在build.gradle的配置。个人认为Android Studio已是趋势,可不必再考虑在项目结构上兼容Eclipse。 2,修改library module的名称,使其简洁清晰 3,修改发布到bintray的配置,使得可以指定发布时的artifactId的名称,而不必要求library的名称与其一致 4,rebound库使用远程依赖,避免别人使用该项目时可能出现的依赖冲突,同时也可减小aar大小 5,README中引用的图片单独放到images文件夹,并且使用相对路径来引用

    opened by msdx 1
  • packageAllDebugClassesForMultiDex

    packageAllDebugClassesForMultiDex

    Error:Execution failed for task ':yearapp_a:packageAllDebugClassesForMultiDex'.

    java.util.zip.ZipException: duplicate entry: com/facebook/rebound/AndroidSpringLooperFactory$ChoreographerAndroidSpringLooper$1.class

    您好,在导入module之后,运行报了上述错误,这是什么原因,该如何解决?

    opened by lby1992 1
  • ToggleButton的build.gradle使用com.facebook.rebound:rebound:0.3.+问题

    ToggleButton的build.gradle使用com.facebook.rebound:rebound:0.3.+问题

    Android studio报错 Error:Execution failed for task ':ToggleButtonSample:dexDebug'.

    com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/jdk1.8.0_31/bin/java'' finished with non-zero exit value 2

    搜索到http://stackoverflow.com/questions/29028705/java-exe-finished-with-non-zero-exit-value-2-when-using-facebook-sdk

    修改ToggleButton的build.gradle,注释原来的compile dependencies {  // compile 'com.facebook.rebound:rebound:0.3.+' //add compile ('com.facebook.android:facebook-android-sdk:4.1.1'){ exclude group:'com.google.android', module: 'support-v4' } } 然后 Android studio提示还需要修改minSdkVersion 8 把两个build.gradle的minSdkVersion 改为14

    opened by suncunhu 1
  • Disabling Animation on ToggleButton

    Disabling Animation on ToggleButton

    I have to disable the sliding animation for some time in ToggleButton, and enable it later time so how can I do that?, can you have methods like public void toggleOn(boolean enableAnimation) so that user can control animation on it, the animation creates a problem when using in a ListView where I have a list of ToggleButtons

    opened by girishnair12345 1
  • 项目整理

    项目整理

    本次PR主要是对项目的整理,修改如下: 1,把项目结构迁移为Android Gradle 项目结构的布局。使用约定的目录可以减少在build.gradle的配置。个人认为Android Studio已是趋势,可不必再考虑在项目结构上兼容Eclipse。 2,修改library module的名称,使其简洁清晰 3,修改发布到bintray的配置,使得可以指定发布时的artifactId的名称,而不必要求library的名称与其一致 4,rebound库使用远程依赖,避免别人使用该项目时可能出现的依赖冲突,同时也可减小aar大小 5,README中引用的图片单独放到images文件夹,并且使用相对路径来引用

    opened by msdx 0
Owner
suke
an Android/Server/Web developer,mobile engineer
suke
A cute widget of Switch Button for you to create beautiful and friendly UI.

SwitchButton To get a quick preview, you can get Demo apk in Google Play or Directly download. This project provides you a convenient way to use and c

kyleduo 4.6k Nov 18, 2022
⭐️ beautiful switch widget with sticky animation ⭐️

StickySwitch StickySwitch library for android this library is beautiful switch widget with sticky animation Requirements Android SDK 15+ Usage Add it

GwonHyeok 768 Nov 10, 2022
A widget you can slide it to open or close something

SlideSwitch About SlideSwitch A button that you can slide on or off How to import into your project Android Studio use gradle. Gradle dependency: Add

Quinn 539 Jul 12, 2022
Base on android-process-button this is the advanced version of the android-process-button.

Rock Button release log Base on android-process-button this is the advanced version of the android-process-button ##Main Features ActionProcessButton

MDCCLXXVI KPT 119 Nov 25, 2022
Android Circular Progress Button

?? Before using this library, read information below ?? This library is not more supported. If you want to add new feature or fix a bug, grab source

Dmytro Danylyk 5.6k Nov 22, 2022
Android Buttons With Built-in Progress Meters.

Description Android Buttons With Built-in Progress Meters. Wiki Home Screenshots User Guide Integration The lib is available on Maven Central, you can

Dmytro Danylyk 3k Nov 20, 2022
FButton - a flat button library for Android

FButton FButton is a custom Button of Android with "Flat UI" concept. FButton's design get inspiration from designmono. This library is very small and

Le Van Hoang 1.4k Nov 17, 2022
Android button which moves in eight direction.

Moving Button Android button which moves in eight direction. Preview Sample Demo You can download demo movie file here : demo.mov It's also on Youtube

Leonardo Taehwan Kim 131 Nov 16, 2022
Button for android with animations for transition and error states.

Transition Button Android Preview Expand animation: Shake animation: Installation Gradle dependencies { implementation 'com.royrodriguez:transitionbu

Roy Rodriguez 133 Dec 1, 2022
AwesomeSwitch is a replacement for the standard Switch(View) android offers, and it offers much more customization than the standard switch component.

AwesomeSwitch AwesomeSwitch is a replacement for the standard Switch(View) android offers, and it offers much more customization than the standard swi

Anoop S S 29 Jun 2, 2022
[] Android floating action button

DEPRECATED Use the FloatingActionButton from the support library instead. FloatingActionButton Description Android floating action button which reacts

Oleksandr Melnykov 4k Nov 19, 2022
Floating Action Button for Android based on Material Design specification

FloatingActionButton Yet another library for drawing Material Design promoted actions. Features Support for normal 56dp and mini 40dp buttons. Customi

Zendesk 6.4k Nov 21, 2022
Bootstrap style widgets for Android, with Glyph Icons

Android-Bootstrap Android Bootstrap is an Android library which provides custom views styled according to the Twitter Bootstrap Specification. This al

Bearded Hen 7.3k Nov 18, 2022
Icons, Borders, Radius ... for Android buttons

⚠️ This library was made years ago when it wasn't that easy to customize Android buttons like today. I highly recommend you to use Material Design but

Mehdi Sakout 1.8k Nov 13, 2022
Android Floating ActionButton with a progress indicator ring

FabProgress Android Circular floating action button with intergrated progress indicator ring As per material design docs Demo: Demo apk HOW TO ADD TO

Kurt Mbanje 779 Nov 28, 2022
👏 The Medium's Clapping Effect developed in Android

?? MediumClap-Android Built with ❤︎ by Wajahat Karim and contributors A Custom Floating Action Button (FAB) library like clapping effect on Medium ??

Wajahat Karim 494 Nov 10, 2022
[] An Android library for an expandable button menu

ExpandableButtonMenu ExpandableButtonMenu is an Android library which implements an expandable button that can be used as a substitute of a fixed size

Lemon Labs 325 Nov 14, 2022
SwitchButton 是 Android 上的一个开关按钮控件 【Deprecated】【Stop maintenance】

SwitchButton 【Deprecated】【Stop maintenance】停止维护了,推荐使用:https://github.com/zcweng/SwitchButton SwitchButton 是 Android 上的一个开关按钮控件 示例 APP 扫描二维码或点我下载 特性 支持

Nameless 334 Nov 15, 2022
This is a UI lib for Android. Effects like shining.

ShineButton This is a UI lib for Android. Effects like shining. Usage shineButton = (ShineButton) findViewById(R.id.shine_button); shineButton.init(

Chad Song 4.2k Nov 25, 2022