我尝试在Titanium中实现可以旋转和缩放的图像。我设法使这项工作正常,但我希望能够滚动图像,如果它比imageView大。我尝试了几个方面,包括添加eventListeners和使用zIndex将正确的视图带到前面,但没有任何帮助。我还尝试了bubbleParent函数,没有任何其他结果。我希望你们中的一些人知道如何实现理想的行为。
XML:
<ScrollView id="imageScrollView">
<View id="pictureView">
<ImageView id="picture" ></ImageView>
</View>
</ScrollView>
TSS:
"#imageScrollView": {
top: "0",
left: "0",
height: "120",
width: "47%",
showHorizontalScrollIndicator: "true",
showVerticalScrollIndicator: "true",
maxZoomScale: "5",
minZoomScale: "1",
backgroundColor: "white",
scrollingEnabled: "true",
borderWidth: "1",
zIndex: "1050"
}
"#pictureView": {
top: "0",
left: "0",
height: "100%",
width: "100%",
bubbleParent: true
}
"#picture": {
top: "0",
left: "0",
height: "100%",
width: "100%",
borderWidth: "3",
borderColor: "red",
bubbleParent: true
}
我的js
$.imageScrollView.addEventListener("scroll", function(e) {
Ti.API.info("Triggered event");
});
$.pictureView.addEventListener("scroll", function(e) {
Ti.API.info("Triggered event");
});