Bug 60188 - Ripple effect not being applied when using SelectableItemBackground
Summary: Ripple effect not being applied when using SelectableItemBackground
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.4.0
Hardware: PC Windows
: Normal blocker
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on: 60966
Blocks:
  Show dependency tree
 
Reported: 2017-10-14 01:14 UTC by mkieres
Modified: 2017-12-11 23:03 UTC (History)
3 users (show)

Tags: ripple, selectableitembackground, ac
Is this bug a regression?: Yes
Last known good build:


Attachments
Repro sample (311.43 KB, application/x-zip-compressed)
2017-10-17 10:23 UTC, mkieres
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 60188 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description mkieres 2017-10-14 01:14:17 UTC
# Steps to reproduce
Bug is related to the Xamarin Forms Android. To reproduce it one will need to create an effect, which is adding a 'ripple' effect to the view. The effect is added by setting the background resource to be SelectableItemBackground. The code for OnAttached method could look something like this:

var view = Control ?? Container;
                if (view == null) return;

                var attrs = new[] { Android.Resource.Attribute.SelectableItemBackground };

                var typedArray = view.Context.ObtainStyledAttributes(attrs);
                int backgroundResource = typedArray.GetResourceId(0, 0);

                view.SetBackgroundResource(backgroundResource);
                typedArray.Recycle();

# Expected behavior
The Control or Container should get the ripple effect when tapping on them

# Actual behavior
No effect is applied

# Supplemental info (logs, images, videos)
This code has been tested and it is working fine with older version of Xamarin Forms: 2.3.4.270

# Test environment (full version information)
Dev env: Visual Studio Community Edition 15.4
Device: Nexus 5S with Android 8.0.0
Xamarin Forms: 2.4.0.282
Xamarin Android Support Libraries: 25.4.0.2
Comment 1 Paul DiPietro [MSFT] 2017-10-16 19:12:16 UTC
Your wording indicates this is a potential regression ("working fine with older version(s)"), unless I'm mistaken. Have you tested against 2.4.0 stable, and can you please upload a minimized reproduction project?
Comment 2 mkieres 2017-10-17 10:23:11 UTC
Created attachment 25330 [details]
Repro sample

Sample references latest Xamarin Forms (2.4.0.282), which shows that ripple effect applied in the TapEffect class is not working. 

When downgrading Xamarin Forms to version 2.3.4.270, the ripple effect is applied

Repro:

1. Run the app
2. Tap/Click on the screen
Comment 3 mkieres 2017-10-31 22:33:37 UTC
It's been a while since I posted my repro sample. There's no response to it and the status of this issue has not changed since (it's still NEEDINFO). 

I understand that this might not be the highest priority on the long list of Xamarin bugs. Although, I would really appreciate if someone could at least have a look at it at confirm that this is truly a bug or not

Thanks
Comment 4 Paul DiPietro [MSFT] 2017-11-01 14:00:41 UTC
Yes, on the surface there appears to be some kind of change in behavior, so I will set this as confirmed for now until we can investigate this further.