我正在嘗試使我的微調框的背景顏色變白。這是我想要對微調控制器做出的唯一改變,但是我看到的每個解決方案都需要製作自定義微調控制器,更改樣式,或者其他一些漫長而過度複雜的過程,以更改顏色。有沒有辦法輕鬆改變顏色。我喜歡創建drawable並將其設置爲背景的方法。我在下面找到的解決方案適用於api> = 23,但我需要的是最小爲19的東西。有沒有簡單的方法,還是必須創建自定義微調器才能更改顏色?這正是我試圖讓它看起來像。Android微調框顏色
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="@color/splashColor" />
</item>
<item android:gravity="center_vertical|right" android:right="8dp">
<layer-list>
<item android:width="12dp" android:height="12dp" android:gravity="center" android:bottom="11dp">
<rotate android:fromDegrees="45">
<shape android:shape="rectangle">
<solid android:color="#000000" />
<stroke android:color="#aaaaaa" android:width="1dp"/>
</shape>
</rotate>
</item>
<item android:width="30dp" android:height="10dp" android:bottom="21dp" android:gravity="center">
<shape android:shape="rectangle">
<solid android:color="@color/splashColor"/>
</shape>
</item>
</layer-list>
</item>
</layer-list>
使用不設置寬度/高度簡化版本(需要> = 23)看起來像這樣
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<solid android:color="@android:color/white" />
</shape>
</item>
<item>
<bitmap
android:gravity="end"
android:src="@drawable/arrow_dropdown" />
</item>
</layer-list>
但它使高度過大,使得整個屏幕似乎關閉。我不知道如何改變高度23 23