Titanium 如何去除钛合金文本字段的边框颜色?
我创建了一个自定义组件,该文本框左侧有一个钢笔图标(因为leftbutton在HTML5/WEB中不支持)。这是我的代码片段Titanium 如何去除钛合金文本字段的边框颜色?,titanium,titanium-mobile,appcelerator,appcelerator-mobile,Titanium,Titanium Mobile,Appcelerator,Appcelerator Mobile,我创建了一个自定义组件,该文本框左侧有一个钢笔图标(因为leftbutton在HTML5/WEB中不支持)。这是我的代码片段 var bg = Ti.UI.createView({ height : app.platform.isAndroid ? 35 : 31, top : 50, width:"94%", backgroundColor : "white", layout:"horizontal"
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 : 'transparent'