2013-09-27 23 views
1

我們在每個工具欄下方都有一個分段按鈕。我們已正確設置了此按鈕。然而,設置pressed的Cls真的很困難。我已經嘗試過幾種形式和谷歌的。希望有人能幫助我。style SegmentedButton Sencha

單擊時,該按鈕應具有#007aFF和textcolor:#fff的背景顏色。而已。我怎樣才能做到這一點。

我們的CSS app.css

//SegmentedButtons 
.customSegmentedButtonPressedCls{ 
    color: #fff; 
    background: #007aff !important; 
} 

.button_pressed.x-button-pressed{ 
color: #148DEA; 
background:#148DEA !important; 
} 

在App分段按鈕部分:

{ 
    xtype: 'segmentedbutton', 
    ui: 'segment', 
    allowDepress: false, 
    width: '100%', 
    id: 'btnLabelSegmented', 
    pressedCls: 'button_pressed', 
    itemId: 'btnLabelSegmented', 
    items: [{ 
     text: 'All', 
     id: 'btnOrderSegmentedAll', 
     itemId: 'btnOrderSegmentedAll', 
     style: { 
      'background-color': '#f8f8f8', 
      'color': '#007aff', 
      'border-right': '1px solid #007aff', 
      'border-left': '1px solid #007aff', 
      'border-top': '1px solid #007aff', 
      'border-bottom': '1px solid #007aff', 
      'font-size': '15px' 
     }, 
     flex: 1, 
     pressed: true 
    }, { 
     text: 'Label 1', 
     style: { 
      'background-color': '#f8f8f8', 
      'color': '#007aff', 
      'border-right': '1px solid #007aff', 
      'border-top': '1px solid #007aff', 
      'border-bottom': '1px solid #007aff', 
      'font-size': '15px' 
     }, 
     id: 'btnOrderSegmentedLabel1', 
     itemId: 'btnOrderSegmentedLabel1', 
     flex: 1 
    }, { 
     text: 'Label 2', 
     style: { 
      'background-color': '#f8f8f8', 
      'color': '#007aff', 
      'border-right': '1px solid #007aff', 
      'border-top': '1px solid #007aff', 
      'border-bottom': '1px solid #007aff', 
      'font-size': '15px' 
     }, 
     id: 'btnLabelSegmentedLabel2', 
     itemId: 'btnLabelSegmentedLabel2', 
     flex: 1 
    }] 
}, 

回答

0

嘗試是這樣的: 不同顏色的變化背景圖像。

.backCls.x-button-pressing{ 
background: url('../images/back_active.png') !important; 
background-repeat: no-repeat; 
background-size: 65px 65px; 
height: 65px; 
width: 65px; 
} 

或者與此相關的問題

How to change change images when click button in sencha

關注