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

标签 android titanium appcelerator

我正在将 iOS 应用转换为与 Android 兼容。

在 iOS 上,如果我这样做:

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

Titanium SDK 5.5.1.G.A

如果 opacity 属性设置为 0 则 View 不可点击,但在 Android 上似乎有所不同。该 View 仍然可以点击。

最佳答案

0 的不透明度仍然意味着对象在那里只是不可见。这可能是两个平台的行为方式的 native 实现。

要正确禁用点击,请使用 touchEnabled 属性

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

有关更多信息,请参阅文档:https://appcelerator.github.io/appc-docs/platform/latest/#!/api/Titanium.UI.View-property-touchEnabled

关于安卓-Appcelerator : UI object with opacity 0 still "clickable"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40467267/

相关文章:

facebook - Titanium facebook模块单线程

ubuntu - 安装 Appcelerator Studio 时连接到下载服务器时出错

android - 在 Listview Titanium SDK 中更改列表项的背景颜色

database - 在 Titanium 中插入和显示来自 SQLite 数据库的数据

appcelerator - openssl 配置失败 : error:02001003:system library:fopen:No such process in Appcelerator studio

javascript - 获取存储在 Ti.Filesystem appcelerator 中的图像

android - 应用程序构建期间的文件重复(gradle 更新后)

android - 使用指纹和密码

java - 使用android studio在内部存储中创建目录和文件夹

android - 我的应用程序和库的 list 之间存在错误