gpt4 book ai didi

android - RelativeLayout中不能存在循环依赖项吗?

转载 作者:行者123 更新时间:2023-12-03 09:14:33 25 4
gpt4 key购买 nike

Exception raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error Log Exception raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error LogException raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window > Show View > Error Log



块引用
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}"
android:id="@+id/layout">


<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="19dp"
android:background="@drawable/gradient_style"
android:gravity="center"
android:text="@string/accelerometer_text"
android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView1"
android:layout_marginTop="61dp"
android:text="@string/x_axis"
android:background="@drawable/gradient_xyz"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:id="@+id/x_axis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView2"
android:layout_alignParentEnd="true"
android:layout_marginStart="18dp"
android:layout_toEndOf="@+id/textView2"
android:background="#f00"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#00f" />

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView2"
android:layout_marginTop="27dp"
android:layout_toStartOf="@+id/y_axis"
android:background="@drawable/gradient_xyz"
android:text="@string/y_axis"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/y_axis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView4"
android:layout_alignStart="@+id/x_axis"
android:layout_alignParentEnd="true"
android:background="#0f0"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#f00" />

<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignEnd="@+id/textView3"
android:layout_below="@+id/textView3"
android:layout_marginTop="33dp"
android:background="@drawable/gradient_xyz"
android:text="@string/z_axis"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:id="@+id/z_axis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView4"
android:layout_alignBottom="@+id/textView4"
android:layout_alignStart="@+id/y_axis"
android:layout_alignParentEnd="true"
android:background="#00f"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#0f0" />

最佳答案

您不应该在以下 View 之间添加循环依赖关系:

从您的代码中删除一行-

remove - `android:layout_above="@+id/textView4"`

从下面看-
<TextView
android:id="@+id/y_axis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView4"
android:layout_alignStart="@+id/x_axis"
android:layout_alignParentEnd="true"
android:background="#0f0"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#f00" />

关于android - RelativeLayout中不能存在循环依赖项吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29210339/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com