如何在sencha touch中的文本字段中添加图像 [英] How to add an image in textfield in sencha touch
本文介绍了如何在sencha touch中的文本字段中添加图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在sencha touch的文本字段中添加一个小图像.例如,用户名文本字段中的一个小用户图标.
I want to add a small image in the text field in sencha touch. For example a small user icon in the username text field.
推荐答案
像这样创建文本字段:
{
xtype: 'textfield',
cls: 'username',
fieldLabel : 'Username', // works for ExtJS
label : 'Username' // works for Sencha Touch
}
并将其添加到您的CSS
and add this to your CSS
.username .x-form-text, .username .x-form-field {
background: url(http://upload.wikimedia.org/wikipedia/commons/thumb/1/12/User_icon_2.svg/48px-User_icon_2.svg.png) no-repeat left;
background-size: contain;
padding-left: 25px;
}
.username .x-form-field { /* Adding more padding for Sencha Touch only */
padding-left: 50px;
}
这篇关于如何在sencha touch中的文本字段中添加图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文