有趣的checkbox动画切换状态(支付宝转账成功显示)--第三方开源--AnimCheckBox

这个很有趣的指标通过AnimCheckBox实现,下载地址:https://github.com/lguipeng/AnimCheckBox
代码:
activity_main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" > <!-- app:circle_color 点击后的背景颜色设置 -->
<!-- app:stroke_color 线条颜色和点击后的勾勾颜色设置 -->
<!-- app:stroke_width 线条宽度设置 --> <com.github.lguipeng.library.animcheckbox.AnimCheckBox
android:id="@+id/checkBox"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
app:circle_color="#1976D2"
app:stroke_width="4dp" /> <Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/checkBox"
android:layout_centerHorizontal="true"
android:paddingTop="20dp"
android:text="button" /> </RelativeLayout>
MainActivity.java:
package com.zzw.testanimcheckbox; import com.github.lguipeng.library.animcheckbox.AnimCheckBox;
import com.github.lguipeng.library.animcheckbox.AnimCheckBox.OnCheckedChangeListener; import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast; public class MainActivity extends Activity {
private boolean temp=true;
private AnimCheckBox checkBox;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); checkBox = (AnimCheckBox) findViewById(R.id.checkBox);
// 设置默认显示为勾还是圈
checkBox.setChecked(temp); checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onChange(boolean checked) {
if(checked==true){
Toast.makeText(getApplicationContext(), "true", 0).show();
}else{
Toast.makeText(getApplicationContext(), "false", 0).show();
}
}
});
findViewById(R.id.button).setOnClickListener(new OnClickListener() { @Override
public void onClick(View v) {
if(temp==true){
temp=false;
}else{
temp=true;
}
//当点击按钮判断值temp变化了的时候,checkBox的随之变化,并且显示出动画效果,
//后面如果是false的话,动画就不会显示,并且画面不会出现变化
checkBox.setChecked(temp,true);
}
});
}
}
有趣的checkbox动画切换状态(支付宝转账成功显示)--第三方开源--AnimCheckBox的更多相关文章
- 动画气泡指示当前滑动值--第三方开源--DiscreteSeekbar
DiscreteSeekbar在github上的项目主页是:https://github.com/AnderWeb/discreteSeekBar DiscreteSeekbar可以自定制的属性很多, ...
- 使用jQuery 中的显示与隐藏动画效果实现折叠下拉菜单的收缩和展开,在页面的列表中有若干项,列表的每项中有一个二级列表,二级列表默认为隐藏状态。点击列表的项,切换二级列表的显示或隐藏状态
查看本章节 查看作业目录 需求说明: 使用jQuery 中的显示与隐藏动画效果实现折叠下拉菜单的收缩和展开,在页面的列表中有若干项,列表的每项中有一个二级列表,二级列表默认为隐藏状态.点击列表的项,切 ...
- android fragment+ FragmentTabHost+viewpager 切换状态不保存的问题
转载请注明出处:http://blog.csdn.net/djy1992/article/details/46674169 @author dujinyang 难得有时间上来写博客. fragment ...
- 纯css实现checkbox开关切换按钮
我们都知道 checkbox 标签默认样式 实在是太low了,故对CheckBox美化很有必要. 现提供两种方式对其进行美化. 方法一 <div class="switch-wrap ...
- (转)利用 SVG 和 CSS3 实现有趣的边框动画
目录 SVG 学习<一>基础图形及线段 SVG 学习<二>进阶 SVG世界,视野,视窗 stroke属性 svg分组 SVG 学习<三>渐变 SVG 学习<四 ...
- Unity---动画系统学习(4)---使用混合树(Blend Tree)来实现走、跑、转弯等的动画切换
1. 介绍 Blend Tree用于多个动画之间的混合,比如走到跑的切换.转弯的切换. 如果用动画学习笔记(3)中的方法,需要新建很多的状态,不仅麻烦,而且切换状态时也很容易不流畅. 而Blend T ...
- Activity左边滑出,右边滑入的动画切换
Activity左边滑出,右边滑入的动画切换 转载请注明出处:http://blog.csdn.net/u012301841/article/details/46920809 大家都知道Android ...
- JS框架_(JQuery.js)文章全屏动画切换
百度云盘 传送门 密码:anap 文章全屏动画切换效果 <!doctype html> <html lang="zh"> <head> < ...
- jQuery鼠标悬停内容动画切换效果
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
随机推荐
- UISearchDisplayController隐藏navigationBar需注意
不能调用self.navigationController.navigationBar.hidden = YES: 调用此代码的话,你隐藏了navigationBar搜索展示控制器就拿不到导航条:就会 ...
- Android Https相关完全解析 当OkHttp遇到Https
一.概述 其实这篇文章理论上不限于okhttp去访问自签名的网站,不过接上篇博文了,就叫这个了.首先要了解的事,okhttp默认情况下是支持https协议的网站的,比如https://www.baid ...
- django 学习-15 .Django文件上传(用户注册)
1.vim blog/views.py from django.shortcuts import render_to_responsefrom django.http import HttpR ...
- HTML5_注册表单的自动聚焦与占位文本
首先看下面要使用HTML自动聚焦和占位文本的示例代码 1: <!DOCTYPE html> 2: <html> 3: <head> 4: <title> ...
- Ubuntu 16.04 Vysor 破解 和黑屏问题解决+ 闪屏问题解决
最新破解更新说明: 参考本人blog: 点我呀 黑屏解决 Vysor使用和黑屏问题 经过了一段时间的艰辛探索,确定是我chrome的PNaCl没有安装,然后又是一段艰辛的Google之后,终于在一个链 ...
- MySQL Server 5.5安装中遇到的问题及解决方法
之前开始用师兄用过的电脑工作,各种不适应,开始重新搭建自己习惯的环境,重装MySQL就是其中一项,然后重装过程中遇到了问题,具体情况总结如下: 1.以前也重新安装过MySQL,但是完全没有用过就直接卸 ...
- Part 11 string functions in sql server
Built in string functions in sql server 2008 LEFT, RIGHT, CHARINDEX and SUBSTRING functions in sql s ...
- Struts2_概述
- ASP.NET MVC自定义路由 - 实现IRouteConstraint限制控制器名(转载)
自定义约束前 namespace MvcApplication2 { public class RouteConfig { public static void RegisterRoutes(Rout ...
- UI4_UITableViewEdit
// // AppDelegate.m // UI4_UITableViewEdit // // Created by zhangxueming on 15/7/13. // Copyright (c ...