10

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.

6
  • I've tried grow up the stroke width, thinking that it could be a screen resolution issue (the initial stroke could be too slim to see), but with no success Oct 3, 2017 at 19:33
  • Are you somehow creating the SignaturePadView during a draw event? Oct 10, 2017 at 14:47
  • I'm not. I have a Page with the SignaturePadView, and it's created on page's initialization with some other controls. Thanks. Oct 10, 2017 at 14:55
  • during the form's initialization or in the OnCreate() function? Oct 10, 2017 at 14:59
  • Hmmm... I'll share the code simplified code of the creation of it's page. I'm creating my view components on the pcl project, not in the specific platform. Oct 10, 2017 at 15:04

2 Answers 2

3
+100

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.

3
  • Thank you for answer. I'm creating it on a page initialization. The user click on a button then another page is opened with the SignaturePadView and other controls. And my SignaturePadView is being created on shared code (PCL), it's the only difference I've noticed from your code Oct 10, 2017 at 15:01
  • I kind of like the idea of creating that object in the platform specific project in the OnCreate() Oct 10, 2017 at 15:19
  • I've couldn't post my implementation yet, but I'll do it soon. I think your approach can be a way to solve my problem. Thanks again. I'll keep searching =). Oct 12, 2017 at 13:57
1

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.