Skip to content

Xamarin Android Signature Pad, can export bitmap / svg

Notifications You must be signed in to change notification settings

chsword/Zou.Signature

Repository files navigation

Zou.Signature

Build status

Install

Install-Package Zou.Signature

Example

image

Sample Code

axml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <Button
        android:id="@+id/clear"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Clear" />
    <Button
        android:id="@+id/getsvg"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Get Svg" />
    <Zou.Signature.SignatureView
        android:id="@+id/view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</LinearLayout>

activity:

    public class MainActivity : Activity
    {

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            var view = FindViewById<SignatureView>(Resource.Id.view); 
            Button clear = FindViewById<Button>(Resource.Id.clear);
            clear.Click += (s, e) =>
            {
                view.Clear();
            };
            Button getsvg = FindViewById<Button>(Resource.Id.getsvg);
            getsvg.Click += (s, e) =>
            {
                var svg = view.GetSVGString();
                var bitmap = view.GetBitmap();
            };
        }
    }

Reference

https://github.com/Batzee/Pocket-Signature-View-Android