2012年12月27日木曜日

Circular dependencies cannot exist in RelativeLayout


最近のADTではレイアウトの変更が簡単になったので、RelativeLayoutの属性で苦しんでいる僕にとっては、LinearLayoutでとりあえず組んで、RelativeLayoutに変更っていう手順がすごく楽なのですが、ときどき次のようなエラーが発生してアプリが起動しなくなることがあります。

12-27 15:34:47.104: E/AndroidRuntime(7123): java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout

このエラーはRelativeLayout内でIDを参照しあっている場合に発生します。
なので、そういう箇所をさがして修正してあげると治りますよ。

    <RatingBar
        android:id="@+id/ratingBar1"
        style="?android:attr/ratingBarStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/view1"
        android:layout_below="@+id/text4" />

    <View
        android:id="@+id/view1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/ratingBar1"
        android:layout_toRightOf="@+id/ratingBar1"
        android:layout_weight="1" />

こういうの

0 件のコメント:

コメントを投稿