Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 17002 [details]
TapGestureRecognizers on a ContentView does not always work in Android.
## Steps to reproduce
1. Launch the attached test project to an Android device or simulator.
2. Tap the ContentViews
Expected result: an entry should be added in the StackLayout at the bottom, showing which View is tapped.
Actual result: for View 3 & 5 no entry is added on Android. This indicates that the assigned Command is not executed.
The only difference between the examples affected by the bug (View 3 and 5) and the working examples View 2 and 4 is the BackgroundColor property being set on nested Layouts in the ContentView to which the TapGestureRecognizer is assigned.
The difference between View 3/5 and View 1 (which has a BackgroundColor set to the nested View, but shows the expected result), is that the nested View in View 3 and 5 is a Layout and View 1 only contains a Label.
In iOS the TapGestureRecognizer works for all Views in the sample project.
Hi Arne, you need to set InputTransparent="true" in your child views, so they don't intercept the tap gestures.
<StackLayout Orientation="Horizontal" BackgroundColor="Red" InputTransparent="true">
<Label Text="View 3: Label in StackLayout with BackgroundColor" />
You should also add to the others that do work as is the expected usage.
Hi Rui, thank you very much for your quick response. Setting the InputTransparent="true" indeed did the trick.
However imho it's a bit confusing that the tap gestures are interecepted in some/most cases with InputTransparent="false" (in my example project: always on iOS and sometimes on Android), but not when a certain property (BackgroundColor) which, on first sight, has nothing to do with the tap gesture, is set.