2013-02-15 77 views
0

大家好我試圖展示一個Android微調,但不顯示爲灰色。我嘗試過使用setFocusable(false),它在編輯框上工作正常,但不在spinners上。除非我說的那樣,否則我不希望微調者可以改變。基本上我有一個顯示數據的屏幕,我想把它放在「更新模式」中。在用戶選擇更新數據之前,應該僅查看。有任何想法嗎?如何禁用android微調器而不使它變灰?

回答

0

我結束了作弊一點 退房this link。在禁用該字段之前,我獲得了背景圖像,然後在禁用該字段後將背景設置爲該圖像。

// Deal with spinners. I don't want to gray out the background 
    // because it looks bad against our dark theme. 
    Drawable d = type.getBackground().getCurrent(); // the enabled background 

    type.setEnabled(enabled); 

    // set all of the spinners back to the enabled background 
    if(!enabled){ 
     type.setBackgroundDrawable(d);   
    } 
1

也許你可以創建一個自定義選擇,並把它設置爲微調的背景下,對於選擇