Problem description
Image resource reference error, there are usually the following similar error logs:
java.lang.NumberFormatException: Color value
'@drawable/xx' must start with #
reason
The most likely cause of this problem is that your image resource name is wrong, and it is likely to start with a number. In Android, if your image is named after a number, the system will treat it as a hexadecimal color value by default, and the definition of these color values often starts with “#”, so there is the following numberformatexception.
Solution
At this time, you need to check whether the name of the wrong resource starts with a number. If it starts with a number, rename it. If not, try to check whether the name of the resource starts with a space in eclipse (of course, the error at this time is that the drawable file cannot be found). If so, modify it. If not, delete the image and add it again.
After renaming, if the layout file cannot be displayed normally, refresh the preview of the layout view or restart the development tool.
Read More:
- Resolution AAPT: error: resource drawable/ (aka xxx) not found
- [Android] button uses the custom drawable file to set the background, and runs “error inflating class button”
- Window installation of MongoDB exception: connect failed exception
- Connection error:Cannot connect to redis-server. Details are available in connection log.
- Org.springframework.beans.factory.xml.xmlbeandefinitionstoreexception: the wildcard matching is comprehensive, but the declaration of element XX: XX XX cannot be found
- You must be logged in to the server (unauthorized)
- JS exception capture: the usage and example analysis of onerror() in window
- Use xx [‘xx ‘] = XX to set field value or does not support field: XXX
- 【EF】An error occurred while updating the entries. See the inner exception for details.
- Springboot error: property ‘sqlsessionfactory’ or ‘sqlsessiontemplate’ are required error details
- How to Fix Spring Boot OTS parsing error: Failed to convert WOFF 2.0
- Some file crashing failed, see logs for details
- Pull the git warehouse code IDEA reports an error: Clone failed: Authentication failed for’http://10.xx.XXXXXXXXXXXXXXXXX’
- Mybatis passes in multiple parameters to mapper. And uses @param details to report an error
- Word failed to convert PDF, export failed due to an unexpected error
- Tensorflow ValueError: Failed to convert a NumPy array to a Tensor
- R:Error : .onLoad failed in loadNamespace() for ‘rJava’, details: call: dyn.load(file, DLLpa
- The solution of a Java exception has occurred. And error exception in thread when eclipse runs
- How to remove the title bar (using the request window feature)( Window.FEATURE_ NO_ Title); why it fails)
- [Android] using request window feature( Window.FEATURE_ NO_ Title) method to remove the title invalid solution