用于绘制平滑签名的自定义Android View
Android 签名板是一个用于绘制平滑签名的 Android 库。它基于 Square 发布的 Smoother Signatures 文章,采用可变宽度的贝塞尔曲线插值。
该库的最新版本可在 Maven Central 上找到。
打开你的 build.gradle,确保在 repositories 部分声明了 Maven Central 仓库:
repositories {
mavenCentral()
}然后,将库作为依赖项包含进来:
implementation 'com.github.gcacace:signature-pad:1.4.0'在你的 pom.xml 中添加此依赖:
<dependency>
<groupId>com.github.gcacace</groupId>
<artifactId>signature-pad</artifactId>
<version>1.4.0</version>
<type>aar</type>
</dependency>请参阅 /SignaturePad-Example 应用,以获取更详细的库使用代码示例。
SignaturePad 视图添加到你想显示的布局中。 <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"
/>penMinWidth - 笔画的最小宽度(默认值:3dp)。penMaxWidth - 笔画的最大宽度(默认值:7dp)。penColor - 笔画的颜色(默认值:Color.BLACK)。velocityFilterWeight - 用于根据先前速度修改新速度的权重(默认值:0.9)。clearOnDoubleClick - 双击清除画板(默认值:false)。可以在视图上设置一个 OnSignedListener:
mSignaturePad = (SignaturePad) findViewById(R.id.signature_pad);
mSignaturePad.setO暂无开放 Issues,或尚未同步最近议题。