Yalantis搜索过滤器与自定义背景颜色为Android
问题描述:
我正在使用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" />
我尝试设置背景颜色,但遗憾的是,过滤器仍然是白色的,这就是结果。
正如您所看到的,颜色出现在特色下面。我希望过滤器本身具有这种颜色来代替,但仍过滤器看起来像这样:
过滤器仍然是白色的。有没有办法改变滤镜颜色?谢谢。
答
请检查图书馆的1.0.3版本,它已经修复。现在,您可以使用expandedBackground
和collapsedBackground
属性
<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
太棒了,谢谢! –
仅仅指刚按照示例轻易改变的背景[这里](https://github.com/Yalantis/SearchFilter) – ADM
这就是我跟着样品。我问的是可以改变过滤器的背景颜色,而不是过滤器项目的颜色。我知道如何改变这一点。他们在示例中给出了代码。 –