Sencha touch 如何在sencha touch中为覆盖面板提供透明背景

Sencha touch 如何在sencha touch中为覆盖面板提供透明背景,sencha-touch,sencha-touch-2,sencha-touch-2.1,Sencha Touch,Sencha Touch 2,Sencha Touch 2.1,下面的代码仅更改面板周围边框的颜色,而不更改面板本身的颜色 var overlay = Ext.Viewport.add({ xtype: 'panel', centered: true, style:'background-color: transparent;', modal: { style: 'opacity: 0' }, hideOnMaskTap:true, width:'20%'

下面的代码仅更改面板周围边框的颜色,而不更改面板本身的颜色

var overlay = Ext.Viewport.add({                
    xtype: 'panel',
    centered: true,
    style:'background-color: transparent;',
    modal: {
        style: 'opacity: 0'
    },
    hideOnMaskTap:true,
    width:'20%',
    height: '50%',
    styleHtmlContent:true,
    items:[{
        xtype:'button',
        test:'hey',
        cls:'notrans',
        style: 'opacity: 1'
    }]
});             

当面板居中时,您需要更改面板的
x-panel-inner
cls。因此,您要做的是为您的面板提供一个
cls
,例如:
cls:my panel

var overlay = Ext.Viewport.add({
    xtype: 'panel',
    centered: true,
    style:'background-color: transparent;',
    cls: 'my-panel',
    ....
});             
现在在自定义样式表中:

.my-panel .x-panel-inner {
    background-color: transparent !important;
}

因此,现在居中面板的背景应该是透明的。

它使背景更改内部背景更改为黑色确保您的
样式
配置设置为:
背景颜色:透明也是。