Relative Layout align an item below and to the middle of another item

android

Solution

Easiest way is to put image and textview into a relative layout

 <RelativeLayout 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:src="@drawable/ic_launcher" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/imageView1"
        android:layout_centerHorizontal="true"
        android:text="TextView" />

 </RelativeLayout>

Edit

To do this in single Layout add `android:drawableTop` to your TextView

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="TextView" 
    android:drawableTop="@drawable/ic_launcher"/>

Problem

I am using a relative layout and want to align a TextView below and in the middle of a button as shown in the attached image. I have can get it to the bottom using BELOW, but cant figure out how to align their horizontal centers.

Original source