1. <?xml version="1.0" encoding="utf-8"?>
  2. <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="fill_parent"
  4. android:layout_height="wrap_content" >
  5. <HorizontalScrollView
  6. android:layout_width="fill_parent"
  7. android:layout_height="wrap_content" >
  8. <RelativeLayout
  9. android:layout_width="fill_parent"
  10. android:layout_height="fill_parent">
  11. <TextView
  12. android:id="@+id/textview1"
  13. android:layout_width="wrap_content"
  14. android:layout_height="wrap_content"
  15. android:text="滚动视图"
  16. android:textSize="30dp" />
  17. <ImageView
  18. android:id="@+id/imageview1"
  19. android:layout_width="wrap_content"
  20. android:layout_height="wrap_content"
  21. android:layout_toRightOf="@id/textview1"
  22. android:src="@drawable/item1" />
  23. <TextView
  24. android:id="@+id/textview2"
  25. android:layout_width="wrap_content"
  26. android:layout_height="wrap_content"
  27. android:layout_toRightOf="@id/imageview1"
  28. android:text="垂直和水平滚动"
  29. android:textSize="30dp" />
  30. <ImageView
  31. <span style="color:#ff6666;">android:id="@+id/imageview2"
  32. </span>                android:layout_width="wrap_content"
  33. android:layout_height="wrap_content"
  34. android:layout_below="@id/textview1"
  35. android:src="@drawable/item2" />
  36. <TextView
  37. android:id="@+id/textview3"
  38. android:layout_width="wrap_content"
  39. android:layout_height="wrap_content"
  40. android:layout_below="@id/imageview2"
  41. android:text="垂直和水平滚动"
  42. android:textSize="30dp" />
  43. <ImageView
  44. <span style="color:#ff6666;"> android:id="@+id/imageview2"</span>
  45. android:layout_width="wrap_content"
  46. android:layout_height="wrap_content"
  47. android:layout_below="@id/textview3"
  48. android:src="@drawable/item3" />
  49. </RelativeLayout>
  50. </HorizontalScrollView>
  51. </ScrollView>

爆出了这样的异常,java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout。

原因就是在RelativeLayout布局中重现了重复的view ID名称,且出现 imageview2 ,textview3,imageview2出现了循环依赖。

解决方案: 将最后一个ImageView的id修改成 imageview3.  避免在RelativeLayout中控件循环依赖。

实质是:1的位置依赖相对于2  2的位置又依赖相对于1 但这两相对位置产生了矛盾。

开发问题及解决--java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout的更多相关文章

  1. java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout

    <TextView android:layout_width="fill_parent" android:layout_height="wrap_content&q ...

  2. android java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout

    造成这个问题的原因是在xml文件中出现了重复依赖,何为重复依赖,如下:   以上便叫重复依赖 转载请标明出处:http://www.cnblogs.com/tangZH/p/8386978.html

  3. 解决java.lang.IllegalStateException: The application’s PagerAdapter changed the adapter’s content

    A界面中有viewpager的动态加载,从界面A跳到界面B,再finish掉B返回A时报出此异常. java.lang.IllegalStateException: The application's ...

  4. 解决java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext问题

    使用ClassPathXmlApplicationContext加载项目时, ClassPathXmlApplicationContext context = new ClassPathXmlAppl ...

  5. 【转】解决java.lang.IllegalStateException: The content of the adapter has changed but ListView...的问题

    原文网址:http://blog.csdn.net/ueryueryuery/article/details/20607845 我写了一个Dialog,Dialog中有一个ListView,想要点Li ...

  6. 解决java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext这个问题

    今天在运行别人的SSH项目时,遇到了这个问题 严重: Exception sending context initialized event to listener instance of class ...

  7. Circular dependencies cannot exist in RelativeLayout

    循环布局错误!!! <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:an ...

  8. response.sendRedirect 报 java.lang.IllegalStateException 异常的解决思路

    今天在进行代码开发的时候,出现了 java.lang.IllegalStateException异常,response.sendRedirect("./DEFAULT.html") ...

  9. 大型网站技术架构(四)--核心架构要素 开启mac上印象笔记的代码块 大型网站技术架构(三)--架构模式 JDK8 stream toMap() java.lang.IllegalStateException: Duplicate key异常解决(key重复)

    大型网站技术架构(四)--核心架构要素   作者:13GitHub:https://github.com/ZHENFENG13版权声明:本文为原创文章,未经允许不得转载.此篇已收录至<大型网站技 ...

随机推荐

  1. 销售合同金额数据从Excel导入

    一.业务需求 1.新增了销售合同金额的字段,但是老数据没有这个字段:所以销售合同金额从销售合同附件的各品种金额之和. 2.制作好excel字段模板,将此模板发送给销售业务部门来统计并完成excel表格 ...

  2. 小米Note3 MIUI9可以用的XPosed框架

    资源来自论坛里的:http://www.miui.com/thread-6449305-1-1.html 首先需要刷入TWRP,资源在这个帖子里:http://www.miui.com/thread- ...

  3. rand和randn

    1,rand 生成均匀分布的伪随机数.分布在(0~1)之间 主要语法:rand(m,n)生成m行n列的均匀分布的伪随机数 rand(m,n,'double')生成指定精度的均匀分布的伪随机数,参数还可 ...

  4. Root test & Ratio test

    几何级数(Geometric Series/Geometric Progression) Root test与Ratio test都依赖于几何级数求和理论,因此这里先讨论该理论. 在数学上,几何级数, ...

  5. Nginx 完整安装篇

    第一步安装各种编译库如c++编译库等 yum install -y gcc //安装GCC ...安装过程省略 yum install -y gcc-c++ //安装C++库用来编译c++ ...安装 ...

  6. Marriage Match III HDU - 3277(二分权值 + 拆点 建边)

    题意: 只不过是hdu3081多加了k种选择 想一下,最多能玩x轮,是不是就是每个女生能最多选x个男生 现在题中的每个女生比3081多了k中选择   那就把女生拆点  i  i‘ i --> i ...

  7. 25 Zabbix系统数据表结构介绍

    点击返回:自学Zabbix之路 点击返回:自学Zabbix4.0之路 点击返回:自学zabbix集锦 25 Zabbix系统数据表结构介绍 自学Zabbix之路15.1 Zabbix数据库表结构简单解 ...

  8. 【BZOJ1022】小约翰的游戏(博弈论)

    [BZOJ1022]小约翰的游戏(博弈论) 题面 BZOJ 题解 \(Anti-SG\)游戏的模板题目. #include<iostream> #include<cstdio> ...

  9. 【CF865D】Buy Low Sell High(贪心)

    [CF865D]Buy Low Sell High(贪心) 题面 洛谷 CF 题解 首先有一个\(O(n^2)\)的\(dp\)很显然,设\(f[i][j]\)表示前\(i\)天手中还有\(j\)股股 ...

  10. 「ZJOI2015」地震后的幻想乡 解题报告

    「ZJOI2015」地震后的幻想乡 想了半天,打开洛谷题解一看,最高票是_rqy的,一堆密密麻麻的积分差点把我吓跑. 据说有三种解法,然而我只学会了一种最辣鸡的凡人解法. 题意:给一个无向图\(G\) ...