Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XF - SignaturePad show strokes only when the touch ends

I'm using SignaturePad with Xamarin.Forms and it works fine even on basic hardware devices, but I've struggled with a weird behavior with just one device: Samsung Galaxy Tab E 7.0 3G SM-T116 Tablet.

The problem is that the strokes on SignaturePad view are shown only when the touch is released from the screen. For example, if I make a long horizontal side to side line slowly, the whole stroke is invisible until I release the screen touch.

Anyone already had a similar situation? How can I workaround it?

Thanks a lot.

like image 545
Diego Rafael Souza Avatar asked Oct 03 '17 14:10

Diego Rafael Souza


2 Answers

Question is a bit old now but this has been resolved in 3.0.0.

I had a similar issue on a Galaxy Tab A which was fixed by upgrading.

like image 132
Aftersow Avatar answered Oct 12 '22 01:10

Aftersow


I've implemented the SignaturePadView in the following way.

MainActivity.cs:

protected override void OnCreate(Bundle savedInstanceState)
{
    base.OnCreate(savedInstanceState);
    // Set our view from the "main" layout resource
    SetContentView(Resource.Layout.Main);

    Xamarin.Forms.Forms.Init(this.ApplicationContext, savedInstanceState);

    signatureView = new SignaturePadView(this);
    signatureView.StrokeWidth = 4;

    LinearLayout signatureLayout = (LinearLayout)FindViewById(Resource.Id.signatureLayout);
    signatureLayout.AddView(signatureView);

    Button btnSave = FindViewById<Button>(Resource.Id.btnSave);
    btnSave.Click += (sender, e) =>
    {
        SaveInfo();
    };

}

Here is the layout in my Main.axml:

<LinearLayout
            android:orientation="vertical"
            android:minWidth="25px"
            android:minHeight="25px"
            android:layout_width="fill_parent"
            android:layout_height="225.0dp"
            android:layout_weight="1"
            android:id="@+id/signatureLayout"
            android:background="@drawable/logosimg"
            android:gravity="center|bottom" />
    </LinearLayout>

I just have a hunch that you are creating a new SignaturePadView object or adding it to the layout after some event happens by the user.

like image 33
Wyatt Shuler Avatar answered Oct 12 '22 02:10

Wyatt Shuler