开发问题及解决--java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout
- <?xml version="1.0" encoding="utf-8"?>
- <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content" >
- <HorizontalScrollView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content" >
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <TextView
- android:id="@+id/textview1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="滚动视图"
- android:textSize="30dp" />
- <ImageView
- android:id="@+id/imageview1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_toRightOf="@id/textview1"
- android:src="@drawable/item1" />
- <TextView
- android:id="@+id/textview2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_toRightOf="@id/imageview1"
- android:text="垂直和水平滚动"
- android:textSize="30dp" />
- <ImageView
- <span style="color:#ff6666;">android:id="@+id/imageview2"
- </span> android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/textview1"
- android:src="@drawable/item2" />
- <TextView
- android:id="@+id/textview3"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/imageview2"
- android:text="垂直和水平滚动"
- android:textSize="30dp" />
- <ImageView
- <span style="color:#ff6666;"> android:id="@+id/imageview2"</span>
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/textview3"
- android:src="@drawable/item3" />
- </RelativeLayout>
- </HorizontalScrollView>
- </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的更多相关文章
- java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content&q ...
- android java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout
造成这个问题的原因是在xml文件中出现了重复依赖,何为重复依赖,如下: 以上便叫重复依赖 转载请标明出处:http://www.cnblogs.com/tangZH/p/8386978.html
- 解决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 ...
- 解决java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext问题
使用ClassPathXmlApplicationContext加载项目时, ClassPathXmlApplicationContext context = new ClassPathXmlAppl ...
- 【转】解决java.lang.IllegalStateException: The content of the adapter has changed but ListView...的问题
原文网址:http://blog.csdn.net/ueryueryuery/article/details/20607845 我写了一个Dialog,Dialog中有一个ListView,想要点Li ...
- 解决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 ...
- Circular dependencies cannot exist in RelativeLayout
循环布局错误!!! <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:an ...
- response.sendRedirect 报 java.lang.IllegalStateException 异常的解决思路
今天在进行代码开发的时候,出现了 java.lang.IllegalStateException异常,response.sendRedirect("./DEFAULT.html") ...
- 大型网站技术架构(四)--核心架构要素 开启mac上印象笔记的代码块 大型网站技术架构(三)--架构模式 JDK8 stream toMap() java.lang.IllegalStateException: Duplicate key异常解决(key重复)
大型网站技术架构(四)--核心架构要素 作者:13GitHub:https://github.com/ZHENFENG13版权声明:本文为原创文章,未经允许不得转载.此篇已收录至<大型网站技 ...
随机推荐
- sql查询表中重复数据个数
select train_code,count(1) from tb_ask_trainbodyroadtrain group by train_code having count(1) >1
- 二:C#对象、集合、DataTable与Json内容互转示例;
导航目录: Newtonsoft.Json 概述 一:Newtonsoft.Json 支持序列化与反序列化的.net 对象类型: 二:C#对象.集合.DataTable与Json内容互转示例: ...
- 【XSY2808】董先生的休闲方案 组合数学
题目描述 有\(n\)个方案,编号为\(1\ldots n\). 最开始你不知道每个方案的编号. 你要按顺序提出这些方案. 每一个时刻你要做以下事情: 如果你阅读过下一个方案,就提出这个方案. 否则随 ...
- bzoj 3123 [Sdoi2013]森林(主席树+启发式合并+LCA)
Description Input 第一行包含一个正整数testcase,表示当前测试数据的测试点编号.保证1≤testcase≤20. 第二行包含三个整数N,M,T,分别表示节点数.初始边数.操作数 ...
- luogu P2680 运输计划 (二分答案+树上差分)
题目背景 公元 20442044 年,人类进入了宇宙纪元. 题目描述 公元20442044 年,人类进入了宇宙纪元. L 国有 nn 个星球,还有 n-1n−1 条双向航道,每条航道建立在两个星球之间 ...
- Codeforces Round #502 (in memory of Leopoldo Taravilse, Div. 1 + Div. 2)
第一次参加cf的比赛 有点小幸运也有点小遗憾 给自己定个小目标 1500[对啊我就是很菜qvq A. The Rank 难度:普及- n位学生 每个学生有四个分数 然鹅我们只需要知道他的分数和 按分数 ...
- emwin之2D图形流位图显示的方法
@2018-10-31 [需求] 界面上绘制状态指示图标 [方法] --① 方法一 外部存储介质上的图标读写与显示 i . 将要显示的图标使用官方软件<BmpCvt.exe>转换成 &q ...
- html内嵌框架
html内嵌框架 <iframe>标签会创建包含另外一个html文件的内联框架(即行内框架),src属性来定义另一个html文件的引用地址,frameborder属性定义边框,scroll ...
- notepad++设置(不断更新)
1.主题设置 主题名称:Obsidian 字体字号:Courier New 10 设置方法: 设置---语言格式设置---选择主题,同时勾选“使用全局字体”“使用全局字体大小 补充一点: 修改两处地方 ...
- mailkit库收发邮件
mailkit库用于收发邮件.这个库可以替代C#自带的发邮件库 环境 W10 / VS2017CMMT / MailKit version="2.0.3" "net46 ...