Search code examples
androidimagebuttonalignment

when i want to put a small image to the right of a text, it doesn't work


 <FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/white"
>
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
>
<TextView
    android:id="@+id/summary"
    android:text="Summary   "
    android:textSize="25px"
    android:textColor="@color/black"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
/>
<ImageView
    android:id="@+id/summary_btn"
    android:src="@drawable/next"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/summary"
    android:layout_toRightOf="@id/summary"
    android:layout_alignBaseline="@id/summary"
/>
</RelativeLayout>
<FrameLayout>

I don't want to make this image a button . But i don't see the error.


Solution

  • I don't know what's special about the id "summary", but if you change your ids so that the TextView is, say, "@+id/s" and the ImageView is, say, "@+id/s_btn" (and change the references in the ImageView to "@id/s" of course) then it seems to work.