If you just want to overlay text on top of the image, just wrap the ImageView in a FrameLayout, and then just define the TextView after the ImageView. It will be located on top. For what you suggest in your original question, the answers of Ruben and Yahel will be the best way.
Example:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/my_image"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Text on Top!"
/>
</FrameLayout>
source
share