Color types not allowed (at ‘drawable’ with value ‘#f0f0f0’)
生活随笔
收集整理的這篇文章主要介紹了
Color types not allowed (at ‘drawable’ with value ‘#f0f0f0’)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
今天在做背景的時候,背景selector里加了如下代碼:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"><item android:state_pressed="true" android:drawable="#f0f0f0"/><item android:state_pressed="false" android:drawable="@android:color/white"/><item android:drawable="@android:color/white"/> </selector>AS編譯報錯:Color types not allowed (at ‘drawable’ with value ‘#f0f0f0’)
到colors.xml定義后引用正常:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"><item android:state_pressed="true" android:drawable="@color/color_study_after"/><item android:state_pressed="false" android:drawable="@android:color/white"/><item android:drawable="@android:color/white"/> </selector> 與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的Color types not allowed (at ‘drawable’ with value ‘#f0f0f0’)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android Studio faile
- 下一篇: AndroidStudio设置不自动弹出