Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

leodan11/SignatureView

Repository files navigation

SignatureView

API License

SignatureView is an open source Android library which allow developers to produce pen and paper like effect for creating signatures on Android

Credits

This is just an updated version of SignatureView and applying some of the active pull requests in it. Credits go completely to its creator and the people who has contributed with those pull requests.

Setup

  • Step 1. Add the JitPack repository to your build file

    Add it in your root build.gradle at the end of repositories:

    allprojects {
      repositories {
        ...
        maven { url 'https://jitpack.io' }
        }
    }

Gradle

  • Step 2. Add the dependency

    dependencies {
      implementation 'com.github.leodan11:SignatureView:Tag'
    }

Kotlin

  • Step 2. Add the dependency

    dependencies {
      implementation("com.github.leodan11:SignatureView:$Tag")
    }

Attributes

SignatureView offers several attributes for a deeper view configuration, the following table shows all these options and their default value.

Name Description Values Default
signature_view_toBackgroundColor Set background color color Color.WHITE
signature_view_toEnable Enable/disable drawing signature on view boolean true
signature_view_toPenColor Set pen stroke color color Color.BLACK
signature_view_toPenSize Set pen stroke size dimension 3dp

Usage

  • Include SignatureView in a layout xml file:
<com.github.leodan11.view.SignatureView
    android:id="@+id/signature_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

More settings example

<com.github.leodan11.view.SignatureView
    android:id="@+id/signature_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:toBackgroundColor="?attr/backgroundColor"
    app:toEnable="true"
    app:toPenColor="?attr/colorPrimary"
    app:toPenSize="3dp" />

Code

  • Include SignatureView:
    val signatureView: SignatureView = findViewById(R.id.signature_view)
  • Clear screen
    signatureView.clearCanvas()
  • Is Bitmap Empty
//Kotlin
signatureView.isBitmapEmpty
//Java
Boolean isEmpty = signatureView.isBitmapEmpty();
  • Get SignatureView as bitmap
//Kotlin
val bitmap: Bitmap = signatureView.signatureBitmap
//Java
Bitmap bitmap = signatureView.getSignatureBitmap();

About

SignatureView is an open source Android library which allow developers to produce pen and paper like effect for creating signatures on Android

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors