Can't convert to color: type=0x2 error when inflating layout in fragment but only on Samsung Galaxy and Note 4
I faced the same issue, that was caused by using attributes
as a reference to color
in an XML drawable.
As mentioned here on API < 21 you can't use attrs to color
in the XML drawable. So only way is to use a reference to a color resource (@color/YOURS_COLOR
) or use #RGB
format.
So if you want to use an XML drawable with theme depended colors you should create a drawable for each theme.
I had the same problem on API 10 devices and it was caused by using theme for API 11+ (from appcompat).For quick solution you may find the following themes declaration in styles.xml
<style name="AppBaseTheme" parent="...">...<style name="AppTheme" parent="...">
And change on:
<style name="AppBaseTheme" parent="android:Theme.Light">...<style name="AppTheme" parent="android:Theme.Light">
Change "AppTheme" to not use Material. For example try:
<style name="AppTheme" parent="android:Theme.Holo"></style>
I had a very similar issue on my Samsung Galaxy Tab Pro 8.4 Running Android 4.2. It worked when I changed Styles.xml to use "android:Theme.Holo" or "Theme.AppCompat.Light.DarkActionBar".
I haven't been able to find any information on exactly why this happens, and why it seems to only affect Samsung products. If you really want to include Material as a style, you could try adding another style file to use with devices that have API level 21 or higher. More info on that is here under the section "Select a theme based on platform version"
Please keep us updated if you find any other fixes.