-2

Ausnahme ausgelöst während des Renderings: Kreis Abhängigkeiten nicht in RelativeLayout existieren kannRelative Layout Abhängigkeit

Fehleranzeige Exception ausgelöst während des Renderings: Kreis Abhängigkeiten können nicht in RelativeLayout existieren

Was sollte ich tun Um diesen Fehler zu beheben, versuche ich verschiedene Möglichkeiten, aber behebe dieses Problem nicht

<RelativeLayout 
     android:id="@+id/mainHeader" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <TextView 
      android:id="@+id/driverPassengerName1" 
      android:layout_width="60px" 
      android:layout_height="90px" 

      android:layout_alignParentTop="true" 
      android:layout_toLeftOf="@+id/driverPassengerName" 
      android:layout_toRightOf="@+id/driverRideDetailBtn" 
      android:background="@color/second_interaction_eighty_percent_opaque_color" 
      android:gravity="center" 
      android:singleLine="false" 
      android:text="Tariq Road Lahore" 
      android:textColor="@color/white" 
      android:textSize="40px" /> 

     <TextView 
      android:id="@+id/driverPassengerName" 
      android:layout_width="100dp" 
      android:layout_height="90px" 
      android:layout_alignParentTop="true" 
      android:layout_marginLeft="2dp" 
      android:layout_marginRight="2dp" 
      android:layout_toLeftOf="@+id/driverCancelRideBtn" 
      android:layout_toRightOf="@+id/driverPassengerName1" 
      android:background="@color/second_interaction_eighty_percent_opaque_color" 
      android:gravity="center" 
      android:singleLine="false" 
      android:text="2222222222222222222222" 
      android:textColor="@color/white" 
      android:textSize="40px" /> 

     <Button 
      android:id="@+id/driverCancelRideBtn" 
      android:layout_width="wrap_content" 
      android:layout_height="70px" 
      android:layout_alignParentEnd="true" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:background="@color/decline_color" 
      android:padding="5px" 
      android:text="@string/cancel_ride" 
      android:textColor="@color/white" 
      android:textSize="18px" 
      android:visibility="visible" /> 

     <ImageButton 
      android:id="@+id/driverRideDetailBtn" 
      android:layout_width="60px" 
      android:layout_height="60px" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:layout_alignParentTop="true" 
      android:background="@drawable/home" 
      android:visibility="visible" /> 
    </RelativeLayout> 

Antwort

0

Sie RelativeLayout sagen zu halten driverPassengerName1 TextViewtoLeft von driverPassengerNameTextView & driverPassengerName zu halten rightOfdriverPassengerName1! Dies ist natürlich zirkuläre Abhängigkeit. Bitte entfernen Sie einen, entweder entfernen

 android:layout_toLeftOf="@+id/driverPassengerName" 

Von Erster Textview

oder

 android:layout_toRightOf="@+id/driverPassengerName1" 

aus dem zweiten Textview

2

Ich kann nicht verstehen, warum Sie Ihre Implementierung erschweren. In Ihrer ganzen Sicht haben Sie layout_alignParentTop="true" erwähnt. Außerdem kann ich sehen, dass Sie nur Ansichten in einer Reihe bilden möchten. Entfernen Sie die Abhängigkeiten toLeftOf und toRightOf aus Ihren Ansichten und verschieben Sie Ihre Ansicht auf LinearLayout.

Ihre Umsetzung sollte wie folgt sein:

<LinearLayout 
     android:id="@+id/mainHeader" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <ImageButton 
      android:id="@+id/driverRideDetailBtn" 
      android:layout_width="60px" 
      android:layout_height="60px" 
      android:background="@drawable/home" 
      android:visibility="visible" /> 

     <TextView 
      android:id="@+id/driverPassengerName" 
      android:layout_width="100dp" 
      android:layout_height="90px" 
      android:layout_marginLeft="2dp" 
      android:layout_marginRight="2dp" 
      android:background="@color/second_interaction_eighty_percent_opaque_color" 
      android:gravity="center" 
      android:singleLine="false" 
      android:text="2222222222222222222222" 
      android:textColor="@color/white" 
      android:textSize="40px" /> 

     <TextView 
      android:id="@+id/driverPassengerName1" 
      android:layout_width="60px" 
      android:layout_height="90px" 
      android:background="@color/second_interaction_eighty_percent_opaque_color" 
      android:gravity="center" 
      android:singleLine="false" 
      android:text="Tariq Road Lahore" 
      android:textColor="@color/white" 
      android:textSize="40px" /> 

     <Button 
      android:id="@+id/driverCancelRideBtn" 
      android:layout_width="wrap_content" 
      android:layout_height="70px" 
      android:background="@color/decline_color" 
      android:padding="5px" 
      android:text="@string/cancel_ride" 
      android:textColor="@color/white" 
      android:textSize="18px" 
      android:visibility="visible" /> 
    </LinearLayout> 

Hoffe, es hilft :)

Verwandte Themen