4

我收到了 FC 的堆栈跟踪,但我无法重现 FC。我错过了什么?

在 java 代码中,一些视图被设置为View.GONEView.VISIBLE取决于应用程序的状态。在LayoutParams我只改变大小和边距。

嵌套的 2RelativeLayouts是因为活动具有半透明主题,第二个是用户可以应用的 alphafilter。

任何帮助都会很棒!

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/FNContainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/clr_background"
android:paddingTop="8dp" >

<RelativeLayout
    android:id="@+id/AlphaContainer"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <xx.xxxxxx.guielements.Footer
        android:id="@+id/footerInclude"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" />

    <xx.xxxxxx.guielements.RoseImageView
        android:id="@+id/RoseView"
        android:layout_width="fill_parent"
        android:layout_height="200dp"
        android:layout_above="@id/footerInclude"
        android:layout_centerHorizontal="true"
        android:layout_margin="5dp" />

    <TextView
        android:id="@+id/tvBeschrijving"
        android:layout_width="fill_parent"
        android:layout_height="250dp"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="8dp" />

    <xx.xxxxxx.guielements.HmpImageView
        android:id="@+id/HmpView"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_alignParentLeft="true"
        android:layout_below="@id/tvBeschrijving"
        android:layout_marginLeft="8dp" />

    <TextView
        android:id="@+id/tvDistToEnd"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@id/HmpView"
        android:text="TC Eind: 1253m"
        android:textSize="20sp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/tvSnelheid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentRight="true"
        android:gravity="top|right"
        android:text="120"
        android:textSize="70sp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/tvSnelheidAanduiding"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@id/tvSnelheid"
        android:gravity="top|right"
        android:text="km/u"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/tvVavg"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@id/tvSnelheidAanduiding"
        android:text="120"
        android:textSize="70sp"
        android:textStyle="bold" />
    <TextView
        android:id="@+id/tvVavgAanduiding"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@id/tvVavg"
        android:gravity="top|right"
        android:text="Ø km/u"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/tvVmaxOnderbord"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@id/footerInclude"
        android:layout_alignParentRight="true"
        android:background="@drawable/onderbord"
        android:gravity="center"
        android:text="6-18h"
        android:textSize="20sp"
        android:textStyle="bold"
        android:visibility="gone" />

    <TextView
        android:id="@+id/tvVmax"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@id/tvVmaxOnderbord"
        android:layout_alignParentRight="true"
        android:background="@drawable/bg_vmax"
        android:gravity="center"
        android:text="120"
        android:textSize="20sp"
        android:textStyle="bold"
        android:visibility="gone" />



</RelativeLayout>

java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout
at android.widget.RelativeLayout$DependencyGraph.getSortedViews(RelativeLayout.java:1321)
at android.widget.RelativeLayout.sortChildren(RelativeLayout.java:316)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:337)
at android.view.View.measure(View.java:15562)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
at android.view.View.measure(View.java:15562)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5109)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:15562)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5109)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1396)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
at android.view.View.measure(View.java:15562)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5109)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2397)
at android.view.View.measure(View.java:15562)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1987)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1228)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1401)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1121)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4598)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
4

2 回答 2

2

我看起来认为你的 xml 并且看起来你没有任何循环引用,如果你说你将一些视图设置为消失我会看看你可以在这里android:layout_alignWithParentIfMissing="true"找到一个例子

我也尝试不将您的任何观点设置为消失,看看您是否仍然有问题。

于 2013-04-16T22:26:27.773 回答
0

通常,当您将视图 A 设置为与另一个视图 B 对齐并且视图 B 与 A 对齐时,就会发生这种情况,这样就会产生循环依赖。

当您设置另一个视图的 id 时,它会发生在上面、下面和对齐等属性上。

于 2013-04-16T22:23:42.760 回答