有趣的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/ ...
随机推荐
- How to solve the SVDI SN Number Display Problem
Yesterday we have learn how to find the SVDI Serial Number, today one of customer from UK look our a ...
- [Java] 模拟HTTP的Get和Post请求
在之前,写了篇Java模拟HTTP的Get和Post请求的文章,这篇文章起源与和一个朋友砍飞信诈骗网站的问题,于是动用了Apache的comments-net包,也实现了get和post的http请求 ...
- Android(java)学习笔记264:Android下的属性动画高级用法(Property Animation)
1. 大家好,在上一篇文章当中,我们学习了Android属性动画的基本用法,当然也是最常用的一些用法,这些用法足以覆盖我们平时大多情况下的动画需求了.但是,正如上篇文章当中所说到的,属性动画对补间动画 ...
- 【Shell脚本学习21】Shell break和continue命令
在循环过程中,有时候需要在未达到循环结束条件时强制跳出循环,像大多数编程语言一样,Shell也使用 break 和 continue 来跳出循环. break命令 break命令允许跳出所有循环(终止 ...
- 转: Android官方培训课程中文版(v0.9.5)
转: https://segmentfault.com/a/1190000004279679 1. 胡凯 tx SNG的一个开发者. http://hukai.me/android-training- ...
- nodejs7-buffer
buffer:js在后台操作的必须用到二进制,buffer类就是用于帮助我们处理这种情况 创建buffer对象: new Buffer(size):创建buff对象,有length属性 buf.f ...
- MVC 使用Jquery实现AJax
View <script type="text/javascript"> function GetTime() { $.get("Home/GetTime&q ...
- $_SERVER 中重要的元素
元素/代码 描述 $_SERVER['PHP_SELF'] 返回当前执行脚本的文件名. $_SERVER['GATEWAY_INTERFACE'] 返回服务器使用的 CGI 规范的版本. $_SE ...
- js 平滑定位
<script type="text/javascript"> function intval(v){ v = parseInt(v); return isNaN(v) ...
- jquery实现点击页面空白隐藏指定菜单
注意:dmenu是一个div的class名哦 代码如下 复制代码 $('html,body').click(function(e){ if(e.target.id.indexOf("dme ...