2017-02-19 84 views
0

我正在使用Android的Yalantis過濾器。我試圖爲下拉列表設置一個黑色的背景顏色。我試圖這樣做是爲了實現它:Yalantis搜索過濾器與自定義背景顏色爲Android

<com.yalantis.filter.widget.Filter 
     android:background="@color/colorPrimaryDark" 
     android:id="@+id/filter" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" /> 

我嘗試設置背景顏色,但遺憾的是,過濾器仍然是白色的,這就是結果。 enter image description here

正如您所看到的,顏色出現在特色下面。我希望過濾器本身具有這種顏色來代替,但仍過濾器看起來像這樣:

enter image description here

過濾器仍然是白色的。有沒有辦法改變濾鏡顏色?謝謝。

+0

僅僅指剛按照示例輕易改變的背景[這裏](https://github.com/Yalantis/SearchFilter) – ADM

+0

這就是我跟着樣品。我問的是可以改變過濾器的背景顏色,而不是過濾器項目的顏色。我知道如何改變這一點。他們在示例中給出了代碼。 –

回答

2

請檢查圖書館的1.0.3版本,它已經修復。現在,您可以使用expandedBackgroundcollapsedBackground屬性

<com.yalantis.filter.widget.Filter 
    app:expandedBackground="@color/colorPrimaryDark" 
    app:collapsedBackground="@color/colorPrimaryDark" 
    android:id="@+id/filter" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" /> 
+0

太棒了,謝謝! –

相關問題