Search code examples
androidandroid-layoutandroid-relativelayout

Android Relative layout "is not a sibling" error


I have a 3 column layout like this:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" ... />
  <LinearLayout>
    <LinearLayout>
       <ImageView
          android:id="@+id/imageIcon" />
       ....
    </LinearLayout>
    <LinearLayout>
      ....
    </LinearLayout>
    <LinearLayout>
      ....
    </LinearLayout>
  </LinearLayout>
  <TextView 
     android:layout_toRightOf="@id/imageIcon" />
</RelativeLayout>

I am getting a "is not a sibling" error at the TextView part of the code. The purpose of the TextView is to act like a "help" display. I'm trying to make sure that the TextView is always at the right side of that ImageView. Is there a better way in doing this?


Solution

  • I ended up using Custom Dialogs instead. I have to compute for the correct position of the dialog and set the values using this:

    getWindow().getAttributes().y = mLocY;
    getWindow().getAttributes().x = mLocX;