如何删除钛文本框的边框颜色?

问题描述:

我已经创建了一个自定义组件,该文本框左侧有一个笔图标(因为leftbutton不会在HTML5/WEB中支持)。这里是我的代码片断如何删除钛文本框的边框颜色?

var bg = Ti.UI.createView({ 
     height : app.platform.isAndroid ? 35 : 31, 
     top : 50, 
     width:"94%", 
     backgroundColor : "white", 
     layout:"horizontal" 
    }); 

    var leftBtnWeb = Ti.UI.createButton({ 
     backgroundImage : app.dir + "img/icons/pen.png", 
     width : 25, 
     top : 8, 
     height : 16, 
     touchEnabled : false, 
    }); 
    bg.add(leftBtnWeb); 

    input = Ti.UI.createTextField({ 
     // top : 5, 
     width:'88%', 
     // left : 2, 
     // right : 20, 
     height : 25, 
     font : { 
      fontSize : "16dp" 
     }, 
     autocorrect : false, 
     returnKeyType : Ti.UI.RETURNKEY_DONE, 
     clearButtonMode : Ti.UI.INPUT_BUTTONMODE_ALWAYS, 
     hintText:"test", 
     backgroundColor:'transparent', 
     zIndex : 10, 
     borderColor : "transparent", 
     backgroundSelectedColor : "transparent", 
     backgroundFocusedColor : "transparent", 
     backgroundImage : "transparent", 
     focusedColor : "transparent", 
     borderStyle : Ti.UI.INPUT_BORDERSTYLE_NONE 

    }); 
    bg.add(input);` 

当我专注于文本框,我得到了蓝色的边框,任何一个可以让我知道如何聚焦时,删除边框。

在此先感谢, Swathi。

我的第一个想法是将自定义焦点事件侦听器附加到您的文本字段并再次设置边框的颜色。

input.addEventListener('focus', function() { 
    borderStyle : Ti.UI.INPUT_BORDERSTYLE_NONE 
    this.hasFocus = true; 
}); 

另一件事你可以尝试为您的backgroundColor设置为透明这样的:

backgroundColor : 'transparent'