Questions raised by Android using theme properties

Source: Internet
Author: User

Recently in the porting of doing a project. Directly changed the application of the theme, the least careful inspection. Results applications are crash directly in some scenarios. Fortunately, by using log, you can see that an error occurred while inflate a resource. Locate the corresponding XML file by locating the ID of the resource, and find that the suspect is that ImageView uses a Theme attribute "? Xxxattr".

XXXATTR is defined as a property of type "reference", but does not point to a specific resource for xxxattr in theme. In the perspective of C language, Xxxattr is the pointer, the resource specified for xxxattr in theme is the specific content that the pointer points to. Because the pointer does exist, there is no error when compiling, but at run time, the run-time error occurs because the pointer is empty. Therefore, it is important to pay attention to this type of problem when using theme attributes.

Think: If you can set a default resource for a property when defining a property, you won't get the problem, why doesn't Google think about it?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.