Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-952] View click event listeners not being invoked on "empty" view space

GitHub Issuen/a
Resolution Date2011-04-17T01:54:46.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0
Labelsandroid, defect
ReporterBill Dawson
AssigneeDon Thorp


Fail case: http://gist.github.com/403933">http://gist.github.com/403933 - the click event only fires if you click into the text field. If you click on an uninhabited portion of the view, you don't get it.


  1. Don Thorp 2011-04-15

    This occurs because of the special background handling and TiBackgroundDrawable. In other words, it fails on simple backgrounds.

  2. hal 2011-04-15

    Adding this simple usecase, as discussed with Don.


    Just swap the last two lines to see that the view1 (red) event listener never fires.

    His explanation was thus:

    "the problem is that when a complex background is added setClickable() in Android is called with true. For a simple background it's not. As a temporary working around give it corners or a background image and your click will work."

  3. hal 2011-04-15

    Just to note, you can add a label to the simple view, and this will allow the view1 event listener to fire, but only when you click the text of the label. For any other area of the simple background, the complex view positioned beneath or over it will fire instead. Here is an example:


  4. hal 2011-04-15

    hehe - sorry, Don!
    I have just noticed that whenever I post an update, it automatically defaults the "who's responsible" option back to Marshall.
    Assigning back to you...

  5. hal 2011-04-15

    btw, as a temporary workaround, you can set borderRadius:0 and the click events work correctly

  6. Don Thorp 2011-04-15

    See #1625 as well

  7. Don Thorp 2011-04-15

    (from [7b6449b75f82462bd18c1c4776ef67f014e18829]) [#952 state:fixed-in-qa][#1625 state:fixed-in-qa] refactored click handling and removed special cases that weren't needed. Note if a view doesn't handle a click Android search up through all components under the touch/click point to find one that will. If you want to stop other views from getting a click (e.g. full screen loading view) just set an no-op click handler on the topmost view http://github.com/appcelerator/titanium_mobile/commit/7b6449b75f82462bd18c1c4776ef67f014e18829"> http://github.com/appcelerator/titanium_mobile/commit/7b6449b75f824...

  8. Thomas Huelbert 2011-04-15 g1 (1.6) simulator 2.2, iOS 4.1

JSON Source