Search code examples
androidtitaniumappcelerator

Android - Appcelerator : UI object with opacity 0 still "clickable"?


I'm converting an iOS app to be compatible with Android.

On iOS if i do this :

Ti.UI.createView({
    width : 10,
    height : 10,
    opacity : 0
});

Titanium SDK 5.5.1.G.A

The view is not clickable if the opacity property is set to 0 , but on Android it seems to be different. The view is still clickable.


Solution

  • An opacity of 0 still means the object is there just not visible. It is probably native implementation how both platforms behave.

    To disable click properly use the touchEnabled property

    Ti.UI.createView({
        width : 10,
        height : 10,
        opacity : 0,
        touchEnabled: false
    });
    

    See the doc for more info: https://appcelerator.github.io/appc-docs/platform/latest/#!/api/Titanium.UI.View-property-touchEnabled