输入字段Sencha Touch 2.0内的按钮 [英] Button inside of an input field Sencha Touch 2.0
问题描述
我尝试实现的是类似的东西:
只有在Sencha Touch应用程序中才有。
我已经实现了一个输入字段,旁边有一个按钮,但没有输入字段内的按钮。
有没有办法在Sencha Touch 2中获得此功能? (不使用css浮动输入上方的按钮。
What I try to achieve is something alike this:
Only then in a Sencha Touch application.
I have achieved an input field with a button next to it but not a button inside of a input field.
Is there a way to get this functionality in Sencha Touch 2? (without using css to float the button above the input.
推荐答案
你可以实现这一点,让我们试试:
you can achieve this, let's try:
{
xtype: 'textfield',
component: {
xtype: 'container',
layout: 'hbox',
items: [
{
xtype: 'textfield',
flex: 3,
},
{
xtype: 'button',
flex: 1,
text: 'test'
}
]},
},
解释:组件
是一个特殊配置输入字段,默认情况下,它设置为 {xtype:input,键入:text}
,这是此解决方法的关键。扩展您的 textfield
vs 按钮
宽度 flex
config
Explanation: component
is a special config for input fields and by default, it's set to {xtype: "input", type: "text"}
, that's the key of this work-around. Scale your textfield
vs button
widths with flex
config
希望它有所帮助。:)
Hope it helps. :)
这篇关于输入字段Sencha Touch 2.0内的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!