如何在用户按下时按下正常按钮?还有如何在单击另一个按钮时使其看起来正常?我们可以使用分段按钮来完成此操作。但是如何使用普通按钮实现呢?
答案 0 :(得分:3)
在sencha-touch-debug.css
中,查看已申请按下的confirm button
..
/* line 73, ../themes/stylesheets/sencha-touch/default/_mixins.scss */
.x-button.x-button-confirm.x-button-pressing, .x-button.x-button-confirm.x-button-pressing:after, .x-button.x-button-confirm.x-button-pressed, .x-button.x-button-confirm.x-button-pressed:after, .x-button.x-button-confirm.x-button-active, .x-button.x-button-confirm.x-button-active:after, .x-toolbar .x-button.x-button-confirm.x-button-pressing, .x-toolbar .x-button.x-button-confirm.x-button-pressing:after, .x-toolbar .x-button.x-button-confirm.x-button-pressed, .x-toolbar .x-button.x-button-confirm.x-button-pressed:after, .x-toolbar .x-button.x-button-confirm.x-button-active, .x-toolbar .x-button.x-button-confirm.x-button-active:after, .x-button.x-button-confirm-round.x-button-pressing, .x-button.x-button-confirm-round.x-button-pressing:after, .x-button.x-button-confirm-round.x-button-pressed, .x-button.x-button-confirm-round.x-button-pressed:after, .x-button.x-button-confirm-round.x-button-active, .x-button.x-button-confirm-round.x-button-active:after, .x-toolbar .x-button.x-button-confirm-round.x-button-pressing, .x-toolbar .x-button.x-button-confirm-round.x-button-pressing:after, .x-toolbar .x-button.x-button-confirm-round.x-button-pressed, .x-toolbar .x-button.x-button-confirm-round.x-button-pressed:after, .x-toolbar .x-button.x-button-confirm-round.x-button-active, .x-toolbar .x-button.x-button-confirm-round.x-button-active:after, .x-button.x-button-confirm-small.x-button-pressing, .x-button.x-button-confirm-small.x-button-pressing:after, .x-button.x-button-confirm-small.x-button-pressed, .x-button.x-button-confirm-small.x-button-pressed:after, .x-button.x-button-confirm-small.x-button-active, .x-button.x-button-confirm-small.x-button-active:after, .x-toolbar .x-button.x-button-confirm-small.x-button-pressing, .x-toolbar .x-button.x-button-confirm-small.x-button-pressing:after, .x-toolbar .x-button.x-button-confirm-small.x-button-pressed, .x-toolbar .x-button.x-button-confirm-small.x-button-pressed:after, .x-toolbar .x-button.x-button-confirm-small.x-button-active, .x-toolbar .x-button.x-button-confirm-small.x-button-active:after {
background-color: #628904;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #3e5702), color-stop(10%, #507003), color-stop(65%, #628904), color-stop(100%, #648c04));
background-image: -webkit-linear-gradient(#3e5702, #507003 10%, #628904 65%, #648c04);
background-image: linear-gradient(#3e5702, #507003 10%, #628904 65%, #648c04);
}
您可以在app.css
文件中包含此css,然后通过设置pressedCls
属性将其应用于您的按钮。
pressedCls: 'x-button-pressed'
答案 1 :(得分:1)
如果是这样,为了回答您的问题,我假设您有2 Ext.Button
,button_1
和button_2
(id
与其姓名相同)
当您点击button_1
并希望它看起来像是按下时:
Ext.getCmp('button_1').setCls('x-button-pressing');
当您点击button_2
时,请执行相似操作并更改button_1
的外观:
Ext.getCmp(`button_2`).setCls('x-button-pressing');
Ext.getCmp(`button_1`).setCls('');
希望这有帮助。
答案 2 :(得分:-1)
启用切换应该有效。 toggleGroup用于对组中的某些按钮进行分组。
{
xtype: 'button',
id: 'btnId'
enableToggle: true,
text: 'Toggele Button',
toggleGroup: 'accountbuttons'
}