Circular dependencies cannot exist in relativelayout error Solution

Source: Internet
Author: User

Android applicationsProgramSave the following error:

11-16 13:07:38. 560: Error/androidruntime (13277): Java. Lang. illegalstateexception: Circular dependencies cannot exist in relativelayout
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. relativelayout $ dependencygraph. getsortedviews (relativelayout. Java: 1286)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. relativelayout. sortchildren (relativelayout. Java: 292)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. relativelayout. onmeasure (relativelayout. Java: 314)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. View. Measure (view. Java: 12733)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. viewgroup. measurechildwithmargins (viewgroup. Java: 4698)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. linearlayout. measurechildbeforelayout (linearlayout. Java: 1370)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. linearlayout. measurehorizontal (linearlayout. Java: 1018)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. linearlayout. onmeasure (linearlayout. Java: 556)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. View. Measure (view. Java: 12733)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. horizontalscrollview. measurechildwithmargins (horizontalscrollview. Java: 1159)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. framelayout. onmeasure (framelayout. Java: 293)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. horizontalscrollview. onmeasure (horizontalscrollview. Java: 303)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. View. Measure (view. Java: 12733)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. viewgroup. measurechildwithmargins (viewgroup. Java: 4698)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. framelayout. onmeasure (framelayout. Java: 293)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. View. Measure (view. Java: 12733)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. viewgroup. measurechildwithmargins (viewgroup. Java: 4698)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. framelayout. onmeasure (framelayout. Java: 293)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. View. Measure (view. Java: 12733)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. viewgroup. measurechildwithmargins (viewgroup. Java: 4698)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. linearlayout. measurechildbeforelayout (linearlayout. Java: 1370)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. linearlayout. measurevertical (linearlayout. Java: 661)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. linearlayout. onmeasure (linearlayout. Java: 554)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. View. Measure (view. Java: 12733)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. viewgroup. measurechildwithmargins (viewgroup. Java: 4698)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. widget. framelayout. onmeasure (framelayout. Java: 293)
11-16 13:07:38. 560: Error/androidruntime (13277): At com. Android. Internal. Policy. impl. phonewindow $ decorview. onmeasure (phonewindow. Java: 2115)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. View. Measure (view. Java: 12733)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. viewrootimpl. extends mtraversals (viewrootimpl. Java: 1069)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. View. viewrootimpl. handlemessage (viewrootimpl. Java: 2447)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. OS. handler. dispatchmessage (handler. Java: 99)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. OS. login. loop (login. Java: 137)
11-16 13:07:38. 560: Error/androidruntime (13277): at Android. App. activitythread. Main (activitythread. Java: 4439)
11-16 13:07:38. 560: Error/androidruntime (13277): At java. Lang. Reflect. method. invokenative (native method)
11-16 13:07:38. 560: Error/androidruntime (13277): At java. Lang. Reflect. method. Invoke (method. Java: 511)
11-16 13:07:38. 560: Error/androidruntime (13277): At com. Android. Internal. OS. zygoteinit $ methodandargscaller. Run (zygoteinit. Java: 787)
11-16 13:07:38. 560: Error/androidruntime (13277): At com. Android. Internal. OS. zygoteinit. Main (zygoteinit. Java: 554)
11-16 13:07:38. 560: Error/androidruntime (13277): At Dalvik. system. nativestart. Main (native method)
11-16 13:07:38. 570: Warn/activitymanager (302): Force finishing activity com. xx. xx/. taskpersonactivity
11-16 13:07:38. 600: verbose/audiohardwaremsm8660 (135): acdb id device ID = speaker_stereo_rx

 

The error indicates that the objects are relatively not centered and cannot be cyclically (mutually) dependent. My layout file is written as follows:

............

<Linearlayout
Android: Id = "@ + ID/linearlayout_line"
Android: layout_width = "fill_parent"
Android: layout_height = "1dip"
Android: layout_below = "@ ID/tl_title"
Android: Background = "@ color/gray">
</Linearlayout>

<Linearlayout Android: Id = "@ + ID/linearlayout_person"
Android: layout_width = "fill_parent" Android: layout_height = "fill_parent"
Android: layout_below = "@ ID/linearlayout_line" Android: Background = "# ffffff">

<Listview Android: Id = "@ + ID/listview_person"
Android: layout_width = "fill_parent" Android: layout_height = "wrap_content"
Android: cachecolorhint = "@ null">
</Listview>
</Linearlayout>

<Linearlayout Android: Id = "@ + ID/linearlayout_line"
Android: layout_width = "fill_parent" Android: layout_height = "5dip"
Android: layout_below = "@ ID/linearlayout_person" Android: Background = "@ color/button_bg">
</Linearlayout>

..........

Take a closer look at the layout file, there are two views with the ID of linearlayout_line. The view for Android: Id = "@ + ID/linearlayout_person" sets layout_below = "@ ID/linearlayout_line ", the bottom Android: Id = "@ + ID/linearlayout_line" sets layout_below = "@ ID/linearlayout_person". Obviously, this layout is impossible, view1 is set at the bottom of view2 and view2 at the bottom of view1, which is obviously impossible if the dependency similar to the loop is in the layout file. Therefore, you only need to set the following Android: Id = "@ + ID/linearlayout_line" to Android: Id = "@ + ID/linearlayout_line11.

==================================================================== Describe my errors, of course, in the following linkArticleMore concise.

Http://serryzhao.iteye.com/blog/833324

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.