百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

android-signaturepad

> 编程语言
开源

用于绘制平滑签名的自定义Android View

2.8K stars0 点赞1 次浏览
访问官网GitHub

工具介绍

用于绘制平滑签名的自定义Android View

Android 签名板

Android 签名板是一个用于绘制平滑签名的 Android 库。它基于 Square 发布的 Smoother Signatures 文章,采用可变宽度的贝塞尔曲线插值。

特性

  • 贝塞尔实现,线条更平滑
  • 基于速度的可变点大小
  • 可自定义笔的颜色和大小
  • 支持位图和 SVG
  • 数据绑定

安装

该库的最新版本可在 Maven Central 上找到。

对于 Gradle 用户

打开你的 build.gradle,确保在 repositories 部分声明了 Maven Central 仓库:

gradle
   repositories {
       mavenCentral()
   }

然后,将库作为依赖项包含进来:

gradle
implementation 'com.github.gcacace:signature-pad:1.4.0'

对于 Maven 用户

在你的 pom.xml 中添加此依赖:

xml
<dependency>
  <groupId>com.github.gcacace</groupId>
  <artifactId>signature-pad</artifactId>
  <version>1.4.0</version>
  <type>aar</type>
</dependency>

使用方法

请参阅 /SignaturePad-Example 应用,以获取更详细的库使用代码示例。

  1. 将 SignaturePad 视图添加到你想显示的布局中。
xml
 <com.github.gcacace.signaturepad.views.SignaturePad
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/signature_pad"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     app:penColor="@android:color/black"
     />
  1. 配置属性。
  • penMinWidth - 笔画的最小宽度(默认值:3dp)。
  • penMaxWidth - 笔画的最大宽度(默认值:7dp)。
  • penColor - 笔画的颜色(默认值:Color.BLACK)。
  • velocityFilterWeight - 用于根据先前速度修改新速度的权重(默认值:0.9)。
  • clearOnDoubleClick - 双击清除画板(默认值:false)。
  1. 配置签名事件监听器

可以在视图上设置一个 OnSignedListener:

java

mSignaturePad = (SignaturePad) findViewById(R.id.signature_pad);
mSignaturePad.setO

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Java

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言