Bug 38602 - TapGestureRecognizer on custom ContentView does not fire on Android
Summary: TapGestureRecognizer on custom ContentView does not fire on Android
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.0.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-02-09 23:26 UTC by Michael Stonis
Modified: 2016-08-10 12:26 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Xamarin.Forms with a sad tap gesture on Android (60.61 KB, application/zip)
2016-02-09 23:26 UTC, Michael Stonis

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 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.

Related Links:

Description Michael Stonis 2016-02-09 23:26:19 UTC
Created attachment 14975 [details]
Xamarin.Forms with a sad tap gesture on Android

If I create a custom ContentView and slap a TapGestureRecognizer on it, the commands will not execute on Android. Everything seems to be just fine on iOS though. I have tried setting different combinations of InputTransparent and Enabled, but it doesn't seem to have an impact. The issue is the same whether I provide a Command or subscribe to events.

There is a similar issue 25943 (https://bugzilla.xamarin.com/show_bug.cgi?id=25943), but this seems to be more related with multiple StackLayouts and setting BackgroundColor.

The attached project works on iOS, but not on Android.
Comment 1 Parmendra Kumar 2016-02-18 13:48:19 UTC
I have checked this issue and able to reproduce this issue. To reproduce this issue I have followed steps mentioned in bug description.

Screencast: http://www.screencast.com/t/0R9p8ru1nK

ApplicationOutput: https://gist.github.com/Parmendrak/5bc0d911d35bcc172ef9
IDELog: https://gist.github.com/Parmendrak/6716088f73639a34f758


Environment Info:

=== Xamarin Studio ===

Version 5.10.2 (build 56)
Installation UUID: 05cfbdd7-b4af-41cd-945a-9db8b054b749
	Mono 4.2.2 (explicit/996df3c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402020030

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/360_macmini/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 24.4
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

=== Xamarin Android Player ===

Version: 0.4.4
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.2 (9548)
Build 7C68

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 962a050
Branch: master
Build date: 2016-01-29 16:59:11-0500

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 510020056
Git revision: bb74ff467c62ded42b7b7ac7fdd2edc60f8647b0
Build date: 2016-01-26 16:24:41-05
Xamarin addins: 8b797d7ba24d5abab226c2cf9fda77f666263f1b
Build lane: monodevelop-lion-cycle6-c6sr1

=== Operating System ===

Mac OS X 10.10.5
Darwin ShrutiMac.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 2 Michael Stonis 2016-03-31 19:59:44 UTC
Any movement on this? Not being able to tap on custom views on Android is currently holding up our app release.
Comment 3 Rui Marinho 2016-08-10 12:26:17 UTC
Hi this doesn't seem a issue, looking at the code, you are missing  InputTransparent = true on the AbsoluteLayout _container at BottomBorderBoxView class.

Try this:

public BottomBorderBoxView(View displayContent, Color backgroundColor)
				this.IsEnabled = true;
				this.InputTransparent = false;

				_container = new AbsoluteLayout
					BackgroundColor = backgroundColor,
					InputTransparent = true