问题描述
嘿,我想使一个通知我的文件上传通知。这是我的XML:但它不断给我的错误:循环依赖不能RelativeLayout的存在。我究竟做错了什么?我看不出什么错?我也想使它看起来类似于浏览器下载
< XML版本=1.0编码=UTF-8&GT?;
< RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:填充=5DP>
< RelativeLayout的
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:ID =@ + ID /左
机器人:layout_toLeftOf =@ + ID /右>
< ImageView的
机器人:ID =@ + ID / status_icon
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentTop =真
/>
<的TextView
机器人:ID =@ + ID / progress_text
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_below =@ + ID / status_icon
机器人:文本=0%
/>
< / RelativeLayout的>
< RelativeLayout的
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:ID =@ + ID /右
机器人:layout_toRightOf =@ + ID /左>
<的TextView
机器人:ID =@ + ID / STATUS_TEXT
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentTop =真
/>
<进度
机器人:ID =@ + ID / status_progress
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_below =@ ID / STATUS_TEXT
机器人:progressDrawable =@机器人:可绘制/ progress_horizontal
机器人:不确定=假
机器人:indeterminateOnly =假
/>
< / RelativeLayout的>
< / RelativeLayout的>
RelativeLayout的左的尝试基础上,RelativeLayout的正确的位置打下自行解决。这不能做,因为作为异常说,它的圆。你怎么能停放一辆车的基础上另外一辆车的停车位,如果这辆车还在动?
根据您的XML文件,我建议您使用的LinearLayout 秒。是不是真的有什么,你在这里做,不能用两个LL的和父RelativeLayout的。
解决Hey I am trying to make a notification for my file uploading notification. This is my XML: but it keeps giving me the error: Circular dependencies cannot exist in RelativeLayout. What am I doing wrong? I dont see anything wrong with it? I was also trying to make it look similar to the browser downloader
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/left"
android:layout_toLeftOf="@+id/right">
<ImageView
android:id="@+id/status_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
/>
<TextView
android:id="@+id/progress_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/status_icon"
android:text="0%"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/right"
android:layout_toRightOf="@+id/left">
<TextView
android:id="@+id/status_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
/>
<ProgressBar
android:id="@+id/status_progress"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/status_text"
android:progressDrawable="@android:drawable/progress_horizontal"
android:indeterminate="false"
android:indeterminateOnly="false"
/>
</RelativeLayout>
</RelativeLayout>
RelativeLayout "left" is trying to lay itself out based on the location of RelativeLayout "right". This cannot be done, because as the exception says, it's circular. How can you park a car based on the parking of another car if that car is still moving?
Based on your xml file, I recommend you use LinearLayouts. There really isn't anything that you are doing here that can't be solved with two LL's and the parent RelativeLayout.
这篇关于为什么我会收到一个CircularDependencyException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!