Android TiTouchImageView是否在合金项目中工作?[更新]
我目前正在为android和iOs开发一个Tianium应用程序,包括一个imageView,它应该是可滚动和可伸缩的(通过一个滑块)。我已经在iOs上实现了这一点,但在Android上很难实现滚动行为。我决定使用该模块,但文档仅显示如何在非合金项目中使用它。我当前的代码如下所示:Android TiTouchImageView是否在合金项目中工作?[更新],android,titanium,titanium-mobile,titanium-modules,Android,Titanium,Titanium Mobile,Titanium Modules,我目前正在为android和iOs开发一个Tianium应用程序,包括一个imageView,它应该是可滚动和可伸缩的(通过一个滑块)。我已经在iOs上实现了这一点,但在Android上很难实现滚动行为。我决定使用该模块,但文档仅显示如何在非合金项目中使用它。我当前的代码如下所示: if (Ti.Platform.osname == "android") { var TiTouchImageView = require('org.iotashan.TiTouchImageView');
if (Ti.Platform.osname == "android") {
var TiTouchImageView = require('org.iotashan.TiTouchImageView');
var androidImageView = TiTouchImageView.createView({
top: 0,
left: 0,
zoom: originalScaleValue,
maxZoom: originalScaleValue*2,
minZoom: originalScaleValue,
image: blob, });
$.androidInnerImageScrollView.add(androidImageView);
} else {
$.iosPicture.setImage(blob);
}
<Module module="org.iotashan.TiTouchImageView" id="androidPicture"></Module>
但是有没有可能通过view.xml将其作为合金组件加载
编辑:我使用alloy中的模块标记进行了尝试:
<ScrollView id="androidInnerImageScrollView">
<Module module="org.iotashan.titouchimageview" id="androidPicture"></Module>
</ScrollView>
是否已将模块引用添加到tiapp.xml?任何模块都应该在Alloy上工作,您只需要维护SDK版本。您是否将模块引用添加到了tiapp.xml?任何模块都应该在Alloy上工作,您只需要维护SDK版本。感谢您的输入Arturo,但这不是问题所在。通过阅读下面的文章,我终于明白了如何在alloy项目中使用模块。我的最终代码如下所示:
if (Ti.Platform.osname == "android") {
var TiTouchImageView = require('org.iotashan.TiTouchImageView');
var androidImageView = TiTouchImageView.createView({
top: 0,
left: 0,
zoom: originalScaleValue,
maxZoom: originalScaleValue*2,
minZoom: originalScaleValue,
image: blob, });
$.androidInnerImageScrollView.add(androidImageView);
} else {
$.iosPicture.setImage(blob);
}
<Module module="org.iotashan.TiTouchImageView" id="androidPicture"></Module>
感谢您的支持,但这不是问题所在。通过阅读下面的文章,我终于明白了如何在alloy项目中使用模块。我的最终代码如下所示:
if (Ti.Platform.osname == "android") {
var TiTouchImageView = require('org.iotashan.TiTouchImageView');
var androidImageView = TiTouchImageView.createView({
top: 0,
left: 0,
zoom: originalScaleValue,
maxZoom: originalScaleValue*2,
minZoom: originalScaleValue,
image: blob, });
$.androidInnerImageScrollView.add(androidImageView);
} else {
$.iosPicture.setImage(blob);
}
<Module module="org.iotashan.TiTouchImageView" id="androidPicture"></Module>
我一直在我的项目中使用它
在xml中
}
在JS中
它工作起来很有魅力。我一直在我的项目中使用它
在xml中
}
在JS中
它就像一个符咒。这不是问题,因为我可以在.js中使用它。我找到了解决方案(见我自己的答案)。这不是问题所在,因为我可以在.js中使用它。我找到了解决办法(见我自己的答案)。