气泡父级无法在android appcelerator中工作

问题描述 投票:0回答:1

我有这样的看法

function addButton(btnName, btnTitle, dataDisplay) {
     var buttonView = Ti.UI.Button({
        id: "btn_view_" + btnName,
        width: Ti.UI.FILL,
        height: Ti.UI.SIZE,
        backgroundColor: "yellow",
        bubbleParent: false
    });



    var chevronLabel = Ti.UI.createLabel({
        id: "chevron_lbl_" + btnName,
        //color: Alloy.Globals.colors.gray,
        //backgroundColor: "blue",
        font: {
            fontFamily: 'FontAwesome',
            fontSize: 20
        },
        height: Ti.UI.FILL,
        right: 5,
        text: Alloy.Globals.fa.chevronRight,
        textAlign: 'center',
        width: 32,

        touchEnabled: false
    });
    //chevronLabel.addEventListener("click", displayList);
    if (Alloy.isTablet) {
        chevronLabel.font = {
            fontFamily: 'FontAwesome',
            fontSize: 25
        };
    }
    select_button = Ti.UI.createTextField({
        id: "btn_" + btnName,
        hintText: btnTitle,
        dataToDisplay: dataDisplay,
        //backgroundColor: "yellow"
        backgroundColor: 'blue',
        borderColor: '#fff',
        borderRadius: 6,
        borderWidth: 1,
        width: '90%',
        editable: false,
        value: "",
        left: "2%",
        bubbleParent: false

    });
    select_button.addEventListener("click", displayList);
    buttonView.add(select_button);
    buttonView.add(chevronLabel);
    return buttonView;
}

我正在将其添加到用户界面的视图中。我的select_button有一个事件监听器。我将气泡父级设置为false,但是我必须双击以使其起作用。我只想单击一次转到下一个屏幕。

android appcelerator
1个回答
0
投票

如果文本字段的singletap属性设置为editable,则对文本字段使用false事件。当文本字段能够专注于其自身时,单击事件才起作用。但是通过将editable设置为false,文本字段无法在第一次尝试中获得焦点。

而且,这不是创建不可编辑字段的好模式,因为文本字段总是试图将注意力集中在Android上,这可能会导致意外结果。

© www.soinside.com 2019 - 2024. All rights reserved.