首先背景是eclipse的項目轉到Androidstudio上來,as的版本是3.0以上的,然後新建項目,複製粘貼xxx的,首先出了個問題,佈局文件說有錯,需要正確build才行,有毒,坑的很,重啓as才搞定。(對了,因爲新版的as新建佈局,都是用的constrantlayout,我是改了系統樣式,刪掉constant的依賴包然後重啓as)然後裝app,發現報錯。
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 0 to color: type=0x5
at android.content.res.TypedArray.getColor(TypedArray.java:496)
at com.fingerfun.a8h5yap.LineProgressBar.<init>(LineProgressBar.java:28)
我第一反應是自定義屬性拿不到?
xmlns:custom="http://schemas.android.com/apk/res-auto"
命名空間哈,custom:lineColor="#FFCC00"控件使用哈。
非常好這篇文章啓發了我,擦
刪掉命名空間,用代碼去設置,程序是可以跑了,。然而還是有一些問題,先不管,做個記錄。