Hi im trying to create a custom layout but i\'m struggling to get it to work properly i\'m getting an error \"circluar dependencies cannot exist in Relative layout\"
Remove android:layout_below="@+id/HomeScore" from first TextView in your layout it creates circular dependencies.
Why ?
Because you set android:layout_alignBottom="@+id/TextView04" in Textview whose id is
android:id="@+id/HomeScore".and first Textview(TextView04) have also android:layout_below="@+id/HomeScore".
<TextView
android:id="@+id/TextView04"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:text="-"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/blue"
android:textStyle="bold" />
Well, you have a few problems here:
TextView04 declares android:layout_below="@+id/HomeScore" and android:layout_centerVertical="true", which conflict
AwayTeam declares android:layout_alignBaseline="@+id/TextView04" and android:layout_alignBottom="@+id/TextView04", which conflict
HomeTeam declares android:layout_alignBaseline="@+id/TextView04" and android:layout_alignBottom="@+id/TextView04", which conflict
AwayScore declares android:layout_alignBaseline="@+id/TextView04" and android:layout_alignBottom="@+id/TextView04", which conflict
As Samir points out, at least one of your circular dependencies is between TextView04 and HomeScore. TextView04 says it is to be below HomeScore, and HomeScore says its bottom is aligned with the bottom of TextView04. However, some of the other ones I note above may also create circular dependencies. Ensure that two widgets do not try to constrain on each other on the same axis (as in TextView04 and HomeScore).
You have a small mistake that might be the reason:
When you reference to another id, don't use @+id/... just @id/.... So everywhere except the android:id attribute the + must be removed.
After you have done that you might get some warnings that point to the possible error!