X.Forms Android Button OnPress Visual Bug

JenaikJenaik DEMember ✭✭
edited April 2018 in Xamarin.Forms

Hey guys,

I'm really frustrated and require some help from you. I'm not really new at Xamarin, but some things won't get in my brain. Maybe I haven't understood the entire logic so far.

But, my problem is: I've been adding a Button to the content page and all were working fine. So, I had to change the background color and now it's messed up! When I click the button, it shows WHILE the press event is invoked, a small visible rectangle with the 0.25 scale of the entire button on the top left of the button.

Can someone help me? I've made a screenshot WHILE PRESSING THE BUTTON here:

Note: BEFORE changing the background color, all has been working fine. AFTER setting the background color, the color gets changed well and is correct but the PRESS/CLICK/ACTIVE state of the button shows a small - unrequired - rectangle on the top left of the button.

Thankful for every answer.

Kind regards,
Dominik G.

Best Answer

  • JenaikJenaik DE ✭✭
    Accepted Answer

    No answers so far, sadly.

    But I've managed a small workaround, and I hope it's fine enough.

    My solution to make a "fake" button was using the Frame element with the MR.Gestures library, given MR.Gestures.Frame with Up and Down events work's fine to handle the active background color while tapping it.

    I'm really sad, that I had to use Frames instead of native buttons. That's not the way it's meant to be used but works well.

    For other peoples facing smiliar problems, try to work with the MR.Gestures library, it's really awesome and you can find it here:

    Direct link:
    http://www.mrgestures.com/

    NuGet:
    Open the NuGet paketmanager and lookup for MR.Gestures and install it for all required solutions.

    I'd still be happy to hear from any expert how to workaround that transparent rectangle while tapping the button!

    Cheers,
    Dominik

Answers

  • JenaikJenaik DEMember ✭✭
    Accepted Answer

    No answers so far, sadly.

    But I've managed a small workaround, and I hope it's fine enough.

    My solution to make a "fake" button was using the Frame element with the MR.Gestures library, given MR.Gestures.Frame with Up and Down events work's fine to handle the active background color while tapping it.

    I'm really sad, that I had to use Frames instead of native buttons. That's not the way it's meant to be used but works well.

    For other peoples facing smiliar problems, try to work with the MR.Gestures library, it's really awesome and you can find it here:

    Direct link:
    http://www.mrgestures.com/

    NuGet:
    Open the NuGet paketmanager and lookup for MR.Gestures and install it for all required solutions.

    I'd still be happy to hear from any expert how to workaround that transparent rectangle while tapping the button!

    Cheers,
    Dominik

  • WojciechBoczarskiWojciechBoczarski USUniversity ✭✭
    edited May 2018

    Same Issue here, it doesn't seem to be on every Device however. We noticed that little bug in Samsung S7, and one of Lenovo Tablets, OnePlus seem to be fine. Might be worth reporting it to Xamarin Bugzilla?

    I assume You are using Latest Xamarin Forms, and Latest Xamarin Android etc? I think latest version has that issue. I never came across it on previous applications I worked on.

    Also are you using Fresh MVVM?

  • Grigory.4715Grigory.4715 USMember

    There is a workaround for those who don't want to use Frames. You can change the Touch animation.
    I used one described here: community. dynamics. com/365/b/dynamics365meritsolutions/archive/2017/04/24/creating-touch-responsive-animated-button-in-xamarin-forms-android
    However, there is one side effect - "Clicked" event isn't activated on button pressing. So you should use Command only.

  • JoseLuisCluaJoseLuisClua USMember ✭✭

    We are having the same issue in android devices. In the "onpress"event a smaller button is generated in the upper left corner in the background. It looks really bad.

  • gekigengargekigengar Member

    Hello, same issues here, using Samsung S8 Plus, still no official fix from Xamarin?

  • abdelrahmanmahmouddabdelrahmanmahmoudd USMember ✭✭

    +1
    using s7 edge

  • JenaikJenaik DEMember ✭✭

    Actually, the bug still happens! Is there NO answer? That's really sad for buttons which are one of the most important elements of Xamarin.

    Please, help us developers.

  • CarLoOSXCarLoOSX USMember ✭✭

    Same issue here... Working in a solution.

  • NielsCupNielsCup NLMember ✭✭✭
    Same issue here...
  • AnthonyRamirezAnthonyRamirez USUniversity ✭✭✭

    same issue

Sign In or Register to comment.