SwitchButton
来源:互联网 发布:mac游戏排行 编辑:程序博客网 时间:2024/06/11 11:27
SwitchButton.An beautiful+lightweight+custom-style-easy switch widget for Android,minSdkVersion >= 11https://github.com/zcweng/SwitchButton
SwitchButton
SwitchButton.An beautiful+lightweight+custom-style-easy switch widget for Android,minSdkVersion >= 11
issues welcome~
Features
-depend without third-part library
-without raw files(pictures/drawables etc...), only one java and style.xml file
-drag switch supported
UseAge
gradle:
repositories { mavenCentral() jcenter()}...dependencies { compile 'com.github.zcweng:switch-button:0.0.3@aar'}
layout.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical"> <com.suke.widget.SwitchButton android:id="@+id/switch_button" android:layout_width="wrap_content" android:layout_height="wrap_content"/></LinearLayout>
Activity.java:
com.suke.widget.SwitchButton switchButton = (com.suke.widget.SwitchButton) findViewById(R.id.switch_button);switchButton.setChecked(true);switchButton.isChecked();switchButton.toggle(); //switch stateswitchButton.toggle(false);//switch without animationswitchButton.setShadowEffect(true);//disable shadow effectswitchButton.setEnabled(false);//disable buttonswitchButton.setEnableEffect(false);//disable the switch animationswitchButton.setOnCheckedChangeListener(new SwitchButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(SwitchButton view, boolean isChecked) { //TODO do your job }});
More Style:
<attr name="sb_shadow_radius" format="reference|dimension"/> 阴影半径<attr name="sb_shadow_offset" format="reference|dimension"/> 阴影偏移<attr name="sb_shadow_color" format="reference|color"/> 阴影颜色<attr name="sb_uncheck_color" format="reference|color"/> 关闭颜色<attr name="sb_checked_color" format="reference|color"/> 开启颜色<attr name="sb_border_width" format="reference|dimension"/> 边框宽度<attr name="sb_checkline_color" format="reference|color"/> 开启指示器颜色<attr name="sb_checkline_width" format="reference|dimension"/> 开启指示器线宽<attr name="sb_uncheckcircle_color" format="reference|color"/> 关闭指示器颜色<attr name="sb_uncheckcircle_width" format="reference|dimension"/> 关闭指示器线宽<attr name="sb_uncheckcircle_radius" format="reference|dimension"/>关闭指示器半径<attr name="sb_checked" format="reference|boolean"/> 是否选中<attr name="sb_shadow_effect" format="reference|boolean"/> 是否启用阴影<attr name="sb_effect_duration" format="reference|integer"/> 动画时间,默认300ms<attr name="sb_button_color" format="reference|color"/> 按钮颜色<attr name="sb_show_indicator" format="reference|boolean"/> 是否显示指示器,默认true:显示<attr name="sb_background" format="reference|color"/> 背景色,默认白色<attr name="sb_enable_effect" format="reference|boolean"/> 是否启用特效,默认true
0 0
- switchbutton
- switchButton
- SwitchButton
- SwitchButton
- 自定义 SwitchButton
- 各种SwitchButton
- 自定义SwitchButton
- android初学-----SwitchButton
- Android SwitchButton 开关按钮
- andorid 自定义SwitchButton
- 仿iOS自定义SwitchButton
- Android CheckBox实现SwitchButton
- android中实现switchButton
- 顶部切换的switchButton
- Android第三方开源SwitchButton
- SwitchButton自定义开关
- 自定义滑动开关SwitchButton
- SwitchButton的用法
- C++多态及虚表深度剖析
- bitmask type 位掩码类型
- mac下Nginx安装与配置
- 浅谈jsp、freemarker、velocity区别
- SSH框架整合后运行出现beans.Userposition_$$_javassist_2 cannot be cast to javassist.util.proxy.Proxy错误的解决方案
- SwitchButton
- [CDQ分治与整体二分]个人对CDQ分治与整体二分的理解
- Java基础知识_day07_(面向对象,构造方法,封装,成员变量与局部变量)
- 中英文对照 —— 图表等的可视化
- 极光推送页面跳转
- CNN在句子相似性建模的应用--tensorflow实现篇1
- selenium + java 框架
- 类的加载流程
- 使用Delve进行Golang代码的调试