Unsupportedoperationexception: Can't convert to dimension: TYPX = 0x1

Source: Internet
Author: User

At Android. content. res. typearray. getdimensionpixelsize (typearray. Java: 463)

This error is encountered today when the project is adapted to run the project. The cause and solution of the error are as follows:

Cause:This error occurs because XXX is not defined in the dimen file when @ dimen/XXX is used to obtain the value.

Cause of recurrence of Project bugs: The dimen values required for an XML file are also divided into three due to the need to adapt to the three sets of devices,

For example,. the XML file in the Setting Height = "@ dimen/a_height", on a device with the dimen in the values-sw540dp file. XML, and there is no project named a_height in the dimen file, although there are dimen files in the other two folders.

A little too long,To put it bluntly, this error occurs when @ dimen/XXX is used to obtain the value, and XXX is not defined in the dimen file.. So this problem occurs, especially when it comes to adaptation processing. Check which folder of the current device contains dimen. xml and perform corresponding processing.

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.