Android Signature Pad
====================
Android Signature Pad is an Android library for drawing smooth signatures. It uses variable width Bézier curve interpolation based on [Smoother Signatures](http://corner.squareup.com/2012/07/smoother-signatures.html) post by [Square](https://squareup.com).
![Screenshot](https://github.com/gcacace/android-signaturepad/raw/master/header.png)
## Features
* Bézier implementation for a smoother line
* Variable point size based on velocity
* Customizable pen color and size
* Bitmap and SVG support
* Data Binding
## Installation
Latest version of the library can be found on Maven Central.
### For Gradle users
Open your `build.gradle` and make sure that Maven Central repository is declared into `repositories` section:
```gradle
repositories {
mavenCentral()
}
```
Then, include the library as dependency:
```gradle
compile 'com.github.gcacace:signature-pad:1.3.1'
```
### For Maven users
Add this dependency to your `pom.xml`:
```xml
<dependency>
<groupId>com.github.gcacace</groupId>
<artifactId>signature-pad</artifactId>
<version>1.3.1</version>
<type>aar</type>
</dependency>
```
## Usage
*Please see the `/SignaturePad-Example` app for a more detailed code example of how to use the library.*
1. Add the `SignaturePad` view to the layout you want to show.
```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"
/>
```
2. Configure attributes.
* `penMinWidth` - The minimum width of the stroke (default: 3dp).
* `penMaxWidth` - The maximum width of the stroke (default: 7dp).
* `penColor` - The color of the stroke (default: Color.BLACK).
* `velocityFilterWeight` - Weight used to modify new velocity based on the previous velocity (default: 0.9).
* `clearOnDoubleClick` - Double click to clear pad (default: false)
3. Configure signature events listener
An `OnSignedListener` can be set on the view:
```java
mSignaturePad = (SignaturePad) findViewById(R.id.signature_pad);
mSignaturePad.setOnSignedListener(new SignaturePad.OnSignedListener() {
@Override
public void onStartSigning() {
//Event triggered when the pad is touched
}
@Override
public void onSigned() {
//Event triggered when the pad is signed
}
@Override
public void onClear() {
//Event triggered when the pad is cleared
}
});
```
4. Get signature data
* `getSignatureBitmap()` - A signature bitmap with a white background.
* `getTransparentSignatureBitmap()` - A signature bitmap with a transparent background.
* `getSignatureSvg()` - A signature Scalable Vector Graphics document.
## Data Binding
The `SignaturePad` view has custom Data Binding attribute setters for all the listener events:
```xml
<com.github.gcacace.signaturepad.views.SignaturePad
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bind="http://schemas.android.com/apk/res-auto"
android:id="@+id/signature_pad"
android:layout_width="match_parent"
android:layout_height="match_parent"
bind:onStartSigning="@{activity.onStartSigning}"
bind:onSigned="@{activity.onSigned}"
bind:onClear="@{activity.onClear}" />
```
## Cordova Plugin
Thanks to [netinhoteixeira](https://github.com/netinhoteixeira/), there is a Cordova plugin using that library.
Please refer to https://github.com/netinhoteixeira/cordova-plugin-signature-view.
## NativeScript Plugin
Thanks to [bradmartin](https://github.com/bradmartin), there is a NativeScript plugin.
Please refer to [https://github.com/bradmartin/nativescript-signaturepad](https://github.com/bradmartin/nativescript-signaturepad).
## Caveats
Currently doesn't support screen rotations. Pull requests are welcome!
## License
Copyright 2014-2016 Gianluca Cacace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
没有合适的资源?快使用搜索试试~ 我知道了~
android-signaturepad.zip
共41个文件
java:11个
xml:9个
png:6个
需积分: 5 0 下载量 154 浏览量
2023-08-18
09:41:01
上传
评论
收藏 202KB ZIP 举报
温馨提示
android-signaturepad
资源推荐
资源详情
资源评论
收起资源包目录
android-signaturepad.zip (41个子文件)
android-signaturepad-master
gradle.properties 2KB
gradle
wrapper
gradle-wrapper.jar 53KB
gradle-wrapper.properties 232B
LICENSE 11KB
gradlew.bat 2KB
build.gradle 433B
settings.gradle 85B
SignaturePad-Example
ic_launcher-web.png 19KB
src
main
java
com
github
gcacace
signaturepad
MainActivity.java 7KB
res
drawable-mdpi
ic_launcher.png 1KB
drawable-xhdpi
ic_launcher.png 2KB
values-sw720dp-land
dimens.xml 269B
drawable-xxhdpi
ic_launcher.png 3KB
values
dimens.xml 213B
strings.xml 294B
styles.xml 694B
layout
activity_main.xml 3KB
values-sw600dp
dimens.xml 196B
drawable-hdpi
ic_launcher.png 2KB
AndroidManifest.xml 869B
proguard-rules.pro 912B
build.gradle 596B
gradlew 5KB
header.png 91KB
.gitignore 325B
signature-pad
src
main
java
com
github
gcacace
signaturepad
utils
SvgBuilder.java 3KB
Bezier.java 1KB
ControlTimedPoints.java 319B
SvgPoint.java 1KB
SignaturePadBindingAdapter.java 2KB
SvgPathBuilder.java 2KB
TimedPoint.java 808B
view
ViewTreeObserverCompat.java 813B
ViewCompat.java 851B
views
SignaturePad.java 20KB
res
values
attrs.xml 410B
AndroidManifest.xml 268B
proguard-rules.pro 912B
proguard-rules-consumer.pro 75B
build.gradle 3KB
README.md 5KB
共 41 条
- 1
资源评论
hello_中年人
- 粉丝: 7
- 资源: 324
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功