如何在sencha中给叠加面板触摸透明背景

Jay*_*k94 2 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%',
    height: '50%',
    styleHtmlContent:true,
    items:[{
        xtype:'button',
        test:'hey',
        cls:'notrans',
        style: 'opacity: 1'
    }]
});             
Run Code Online (Sandbox Code Playgroud)

ccl*_*lle 5

x-panel-inner当面板居中时,您需要更改面板的cls .所以你要做的就是给你的小组cls例如:cls: my-panel.

var overlay = Ext.Viewport.add({
    xtype: 'panel',
    centered: true,
    style:'background-color: transparent;',
    cls: 'my-panel',
    ....
});             
Run Code Online (Sandbox Code Playgroud)

现在在您的自定义样式表中:

.my-panel .x-panel-inner {
    background-color: transparent !important;
}
Run Code Online (Sandbox Code Playgroud)

所以现在你的中心面板的背景应该是透明的.