我在Smartface.io框架中工作,使用标签和重复框。现在,我无法访问repeatbox的onSelectedItem,因为每一行中的标签似乎都在前面,从而阻塞了实际的repeatbox。有没有办法把标签送到中继箱后面?我尝试将z:"1“添加到lbl中,并将z:"8”添加到repeatBox1变量中。任何帮助都将不胜感激。
谢谢
var lbl = new SMF.UI.Label({
top : "0%",
left : "0%",
width : "50%",
height : "100%",
z-index : "0",
fillColor : "#FFFFFF",
textAlignment : SMF.UI.TextAlignment.center
});
var repeatBox1 = new SMF.UI.RepeatBox({
width : "90%",
height : "40%",
left : "5%",
top : "10%",
z : "8",
showScrollbar : true,
fillColor : "white",
backgroundTransparent : true
});
repeatBox1.dataSource = qq;
repeatBox1.controls.
repeatBox1.onRowRender = function (e) {
this.controls[0].text = qq[e.rowIndex].users;
};
repeatBox1.onSelectedItem = function (e) {
//Pages.Page2.show();
alert("Selected " + (e.rowIndex + 1) + ". row");
};
repeatBox1.onRowDeleting = function (e) {
if (e.rowIndex === 0) {
alert("first row is deleted...");
}
};
repeatBox1.itemTemplate.height = Device.screenHeight / 7;
repeatBox1.itemTemplate.imageFillType = SMF.UI.ImageFillType.stretch;
repeatBox1.itemTemplate.add(lbl);
Pages.Page1.add(repeatBox1);发布于 2015-12-10 16:33:52
label的行为不可能像它在repeatbox框后面一样。但是您可以使用label的e.rowIndex。当标签被触摸时,它返回e.rowIndex值。
var lbl = new SMF.UI.Label({
top : "0%",
left : "0%",
width : "50%",
height : "100%",
// z-index : "0",
fillColor : "#FFFFFF",
backgroundTransparent : false,
textAlignment : SMF.UI.TextAlignment.center,
onTouch : function (e) {
alert("index: " + e.rowIndex);
}
});https://stackoverflow.com/questions/34191268
复制相似问题