第三方开源Android TickPlusDrawable状态可以通过动画切换的按钮
作者:Z2 时间:2022-11-20 01:21:18
先给大家展示下效果图,对第三方开源 android tickplusdrawable相关知识感兴趣的朋友一起学习吧。
Android tickplusdrawable(TickPlusDrawable)是一个状态可以通过动画切换的按钮,Android tickplusdrawable(TickPlusDrawable)在github上的项目主页是:https://github.com/flavienlaurent/tickplusdrawable
测试代码:
布局:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/view"
android:layout_gravity="center"
android:padding="30dp"
android:layout_width="128dp"
android:layout_height="128dp" />
</FrameLayout>
JAVA代码:
package com.flavienlaurent.tickplusdrawable;
import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends Activity {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
View view = findViewById(R.id.view);
// 第一个参数表示里面+号和勾的宽度,第二个参数是圆圈背景色和勾的颜色,
//第三个参数是默认的加号的颜色,只显示一次
final TickPlusDrawable tickPlusDrawable = new TickPlusDrawable(10,
0xff9C27B0, 0xff2196F3);
view.setBackground(tickPlusDrawable);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tickPlusDrawable.toggle();
}
});
}
}
以上内容是小编给大家分享的第三方开源Android TickPlusDrawable状态可以通过动画切换的按钮,希望大家喜欢。
标签:android,第三方开源,tickplusdrawable
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Android Studio设置或修改Android SDK路径方法
2023-11-07 17:22:10
![](https://img.aspxhome.com/file/2023/0/122240_0s.png)
Android App中自定义View视图的实例教程
2021-08-16 16:54:35
![](https://img.aspxhome.com/file/2023/7/137857_0s.jpg)
Java比较两个对象大小的三种方法详解
2021-07-11 18:55:16
![](https://img.aspxhome.com/file/2023/7/88157_0s.png)
java实现上传文件类型检测过程解析
2023-11-09 12:04:21
基于C#技术实现身份证识别功能
2023-10-01 14:16:26
![](https://img.aspxhome.com/file/2023/8/91358_0s.png)
C# Dynamic关键字之:dynamic为什么比反射快的详解
2021-06-24 04:22:35
![](https://img.aspxhome.com/file/2023/8/129688_0s.jpg)
Java 动态模拟操作系统进程调度算法
2023-04-10 15:09:20
![](https://img.aspxhome.com/file/2023/9/125669_0s.png)
Java多线程的其他知识_动力节点Java学院整理
2023-09-06 06:01:58
![](https://img.aspxhome.com/file/2023/2/68032_0s.png)
Java使用BigDecimal进行高精度计算的示例代码
2023-03-25 10:35:43
spring cloud config 配置中心快速实现过程解析
2022-02-19 06:50:22
Springboot Websocket Stomp 消息订阅推送
2022-05-08 14:39:30
![](https://img.aspxhome.com/file/2023/1/106141_0s.jpg)
Android使用SQLite数据库的示例
2023-09-17 07:36:58
![](https://img.aspxhome.com/file/2023/1/139371_0s.png)
Mybatis通过数据库表自动生成实体类和xml映射文件
2022-01-11 07:05:46
Android将项目导出为Library并在项目中使用教程
2022-01-31 14:57:17
![](https://img.aspxhome.com/file/2023/9/125439_0s.png)
Spring4如何自定义@Value功能详解
2021-12-16 06:31:12
Java实现用户管理系统
2023-08-26 17:18:21
极简的Resty服务端和客户端RESTful框架
2022-01-19 19:51:00
Spring Boot非Web项目运行的方法
2021-07-23 13:05:32
java反射机制给实体类相同字段自动赋值实例
2023-11-25 19:52:29
C++实现String类的方法详解
2023-04-27 08:49:27