xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

Android Buttons shows ripple effect only on the upper left area of the button on Samsung devices when changing/setting the buttons background color #2096

Open ZwaanBanaan91 opened 6 years ago

ZwaanBanaan91 commented 6 years ago

Android Buttons shows ripple effect only on the upper left area of the button on Samsung devices when changing/setting the buttons background color

Steps to Reproduce

  1. Place a button in your layout.
  2. Set the buttons background color.
  3. Run your app on a Samsung device
  4. Press the button.

Expected Behavior

Butten should highlight with normal ripple effect

Actual Behavior

Highligh with ripple only appears in the left upper part of the button.

Basic Information

Screenshots

bugscreenshotsamsunggalaxyxamarin

Reproduction Link

ButtonText.zip

jmbowman1107 commented 6 years ago

Any update on this issue? Surprising this issue is holding up a release for us. This also seems to happen when just setting the CornerRadius as well. Can confirm this happens on Galaxy S6 as well.

rpkwv8 commented 6 years ago

I am also encountering this (Samsung Note 8). This did not occur on version 2.5.0.122203. On Version 2.5.0.280555, it appears slightly above and to the left of the button, roughly half in/half out of the boundaries of the button. I tried out 2.5.1.392594-pre3 today and I get the same results as the initial post's screenshot. It occurs when I press the button, which triggers a background color change, and drag off of the button. It goes away when the button returns to it's original unpressed background color.

Minneth commented 6 years ago

This does seem specific to Samsung devices. You can get around it by removing the background colour. If you still need a coloured button, you'll currently have to create a custom renderer and add a tint.

PaulVrugt commented 6 years ago

As this did not happen in 2.5.0.122203, this seems to be a regression. Can someone add the correct label?

TheRealBlip commented 6 years ago

Experiencing the same regression with both background / border colors on Samsung XCover 3/4 devices. Creating a custom renderer and adding a tint is not an acceptable solution.

erdemyavuzyildiz commented 6 years ago

I have the same annoying issue, only top left part of the buttons have the ripple effect. For the user, it definitely feels like the application is broken or buggy.

Phone is Samsung Galaxy Note-8: SM-N920C Android 7.0-API 24

rodrigotristany commented 6 years ago

somebody found a solution?

leeanpeng commented 6 years ago

Is there any workaround ?

albernazf commented 6 years ago

Did anybody find a solution? I'm experiencing same issue with all Samsung devices

standamikes commented 5 years ago

I did it through a custom renderer. This is my workaround, so it might not cover all your styling of the button. However, it will remove the broken ripple effect on Samsung devices.

https://gist.github.com/standamikes/4aa9a84dd6a05ac953269808b8be0a6c

ghost commented 5 years ago

Thank you standamikes, that solution works for me and has allowed me to greatly improve the look and feel of my android apps. I would really like to be able to work out solutions like that myself but it appears I need more native android knowledge in order to do so.

ghost commented 5 years ago

I did it through a custom renderer. This is my workaround, so it might not cover all your styling of the button. However, it will remove the broken ripple effect on Samsung devices.

https://gist.github.com/standamikes/4aa9a84dd6a05ac953269808b8be0a6c

Unfortunately after further investigation I have discovered a couple of issues with this solution.

If using a MvxAsyncCommand from the button which awaits a user action e.g a confirmation alert, the button background disappears for the duration of the await.

If a property on the button is changed, eg the border colour, using bindable properties the fix breaks and the button is re-rendered in the same broken style as it was before the fix.

praveenBaruri commented 5 years ago

Same issue here.... Any solutions or plugins to solve this issue?

brzezinol commented 5 years ago

Xamarin team, will it be fixed? Especially on samsung devices. Bcause I don't know what should I plan with it.

Frekvens1 commented 5 years ago

Can confirm this happens on Samsung Galaxy Tab 4 as well.

PureWeen commented 5 years ago

FYI the new material button doesn't exhibit this behavior on Samsung https://github.com/xamarin/Xamarin.Forms/pull/4967

If you want to try using that instead

LucaZiegler commented 5 years ago

Same on Galaxy Note 8. Please fix it!

sebikrt commented 5 years ago

Still reproducible. This is still open. Is there planned any soon fix for this?

PauchardThomas commented 5 years ago

Still reproducible; Samsung Galaxy A3. Help

Maxallica commented 5 years ago

Still reproducible with SAMSUNG Galaxy Tab A6.

Xamarin.Forms: 3.5.0.129452 Xamarin.Android.Support.Annotations: 28.0.0.1 Xamarin.Android.Support.Compat: 28.0.0.1 Xamarin.Android.Support.Core.UI: 28.0.0.1 Xamarin.Android.Support.Design: 28.0.0.1 Xamarin.Android.Support.Fragment: 28.0.0.1 Xamarin.Android.Support.Media.Compat: 28.0.0.1 Xamarin.Android.Support.v4: 28.0.0.1 Xamarin.Android.Support.v7.AppCompat: 28.0.0.1 Xamarin.Android.Support.v7.CardView: 28.0.0.1 Xamarin.Android.Support.v7.MediaRouter: 28.0.0.1 Xamarin.Android.Support.v7.RecyclerView: 28.0.0.1

gitbash-basher commented 5 years ago

This is my workaround for this issue.

  1. Create a custom renderer and use this for android. https://gist.github.com/gitbash-basher/8ec4220131743d7d7eefcebee9e3890c

  2. Then add this to Android/Resources/drawable https://gist.github.com/gitbash-basher/f2bd1219f87de2f80c372c065910d2b1

ChrisTTian667 commented 5 years ago

Same on Samsung XCover 4.

LennoxP90 commented 5 years ago

Issue still exists with material design

langtu commented 5 years ago

Issue from years ago. I dont understand why xamarin team could not fix it.

canmrt commented 5 years ago

I also have the issue on Samsung's Galaxy S8+ - android 8.0.0.

contrix09 commented 5 years ago

Issue still present. Samsung Tab S3 - Android 9.0.

PureWeen commented 5 years ago

@xXdRaGoNrIdDeRXx what device are you testing on? I've used the material button with a Samsung s8 and s9 and they both ripple

LennoxP90 commented 5 years ago

Samsung J3, Samsung S5, Samsung S6

PureWeen commented 5 years ago

@xXdRaGoNrIdDeRXx can you create a new issue related to material button and with your project attached? I've tested material buttons with a few samsung phones and for me they all ripple.

The thing about the materialbutton is that it's almost 100 percent handled by the native material button written by android whereas the non material button is written by us

so if Material Button isn't rippling for you then that's going to be an upstream issue for google that might be fixed by android x

if you can test the material button with native android and see if that ripples for you

LennoxP90 commented 5 years ago

I cannot upload my project that it is doing it due to NDA issues with my company, but when i get back to work i will test a small project to see if it is an issue.

LennoxP90 commented 5 years ago

also ripple works fine on any phone other than samsung phones we test with

LennoxP90 commented 5 years ago

ranging from android 6.x to 9.0

jlzapata commented 5 years ago

I have the same issue in Samsung Galaxy Note 5.

PureWeen commented 5 years ago

@jlzapata can you test with a material button? https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/visual/material-visual

LennoxP90 commented 5 years ago

Using latest XF 4.1.0.618606, The regular buttons using Visual="Material" are working fine, but ImageButtons using Visual="Material" has this defect. My guess is there is no such thing as a material imagebutton, and still uses the legacy broken renderer.

<ImageButton x:Name="btnContacts" Grid.Column="1" Source="ic_action_contacts" BackgroundColor="#4C4C4C" VerticalOptions="Center" HorizontalOptions="Center" WidthRequest="50" HeightRequest="45" Padding="10, 0, 10, 0" Visual="Material" Command="{Binding NavigationCommand}" CommandParameter="Contacts"/>

Tested on Samsung Galaxy S6 SM-G920W8 running android 7.0

LennoxP90 commented 5 years ago

ImageButtons are still broken

njdwklopper commented 5 years ago

2019, September... This is STILL an issue. How? To help, test on Samsung devices. It seems to be the common pattern.

Syed-Esqimo commented 5 years ago

The issue seems to be on Samsung devices running below Android 9. Such as Galaxy S7 running on Android 8.0 @PureWeen @davidortinau @pauldipietro. Please guys if there is a workaround plus solution address the issue and update this github issue. This is Microsoft backed team, this is unacceptable.

LennoxP90 commented 5 years ago

@davidortinau, @PureWeen, @pauldipietro, Is there going to be a fix for the ImageButton? Is it going to get a material renderer? Fix for the non material button?

LennoxP90 commented 4 years ago

<ImageButton x:Name="btnContacts" Grid.Column="1" Source="ic_action_contacts" HorizontalOptions="CenterAndExpand" WidthRequest="35" Visual="Material" Command="{Binding NavigationCommand}" CommandParameter="Contacts"/>

still has issue with latest Xamarin forms / visual.material: 4.3.0.991221

PureWeen commented 4 years ago

@xXdRaGoNrIdDeRXx Yes, we have some more material work scheduled for the road map and getting ImageButton over to material will be one of the first things we do.

sthewissen commented 4 years ago

I have the same thing happening but fixed it using the following renderer. What this does is create a new background drawable with the existing drawable's properties for border, corners, colors etc. When pressed it sets -0.05 luminosity on the background color, making it a little bit darker. It's not a ripple, but it's something.

https://gist.github.com/sthewissen/2f54227793c8a512fefae6b779d18b28

marc-four commented 4 years ago

Still reproducible: Samsung Galaxy A3 2017 (A320FL).

BabaDorin commented 4 years ago

:( Same. Galaxy S7 Edge

VollRahm commented 4 years ago

Having Trouble with this right now on Samsung Galaxy S7. It works with a Custom Renderer but then there is no animation. When i manually make a animation changing properties the Button gets this weird Ripple again. @sthewissen Renderer is a good workaround for this.

LennoxP90 commented 4 years ago

has there been any direction on this?

breenbob commented 4 years ago

Typically, my client uses exclusively Samsung devices. So I've taken the gist published by @sthewissen as a starting point and modified it to use a RippleDrawable. In my app, I have lots of different types of buttons including ones that I don't want to show a ripple on and can't subclass to target selectively. So I've implemented this as an IVisual - add the empty RippleButtonVisual class to your shared project, add the ripple button renderer to your Droid project, and add the following style attribute to the buttons you selectively want to apply the ripple to: Visual="RippleButtonVisual"

Looks like this for me: 2020-07-20_01-17-37

chaoyebugao commented 4 years ago

Year 2020 is going to an end, problem still exists...

Cfun1 commented 3 years ago

@PureWeen I can confirm it is still happening on Samsung devices running Android 8.0.0, but not with Visual="Material" , any progress/work on this since ?