Error of no resource found that matches the given name in relativelayout of Android

Source: Internet
Author: User
========================================================== =============================== Original blog, reprinted please declare the source of Electronic coffee (original id blue rock) ========================================================== ================================

Android relativelayout Error

Error: no resource found that matches the given name (at 'yout _ toleftof 'with value' @ ID/
Main_auto_checkbox ').

Later I found out that I referenced the ID of B in A, but the ID of B is declared later, and the compiler is executed in sequence (in my opinion), so I cannot find it, when I put the statement of B in front of a, it's okay,

<Relativelayout Android: Orientation = "horizontal" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: gravity = "center"> <textview Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: gravity = "center" Android: layout_toleftof = "@ ID/main_auto_checkbox" -- the error is returned, android: text = "auto-fix" Android: layout_centervertical = "true"/> <checkbox Android: id = "@ + ID/main_auto_checkbox" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_alignparentright = "true" Android: layout_marginright = "3dip"/> </relativelayout>

, Change the Declaration Order of the checkbox and textview. This is correct.

<Relativelayout Android: Orientation = "horizontal" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: gravity = "center"> <checkbox Android: id = "@ + ID/main_auto_checkbox" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_alignparentright = "true" Android: layout_marginright = "3dip"/> <textview Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: gravity = "center" Android: layout_toleftof = "@ ID/main_auto_checkbox" Android: text = "auto fix" Android: layout_centervertical = "true"/> </relativelayout>


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.