首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何调整z值?

如何调整z值?
EN

Stack Overflow用户
提问于 2015-12-10 07:51:37
回答 1查看 62关注 0票数 0

我在Smartface.io框架中工作,使用标签和重复框。现在,我无法访问repeatbox的onSelectedItem,因为每一行中的标签似乎都在前面,从而阻塞了实际的repeatbox。有没有办法把标签送到中继箱后面?我尝试将z:"1“添加到lbl中,并将z:"8”添加到repeatBox1变量中。任何帮助都将不胜感激。

谢谢

代码语言:javascript
运行
复制
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);
EN

回答 1

Stack Overflow用户

发布于 2015-12-10 16:33:52

label的行为不可能像它在repeatbox框后面一样。但是您可以使用label的e.rowIndex。当标签被触摸时,它返回e.rowIndex值。

代码语言:javascript
运行
复制
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);
        }
    });
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34191268

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档