12

I have a quite simple question to ask: I need to put a small logo over an ImageView, large all the screen, in the bottom right area of the screen, but I don't know how to set the coordinates or how to say the ImageViews to be in a relative position.

Something like this:

enter image description here

Stefano
  • 263
  • 1
  • 3
  • 10
  • You can look into FrameLayout. [Heres](http://mobileorchard.com/android-app-development-%E2%80%93-layouts-part-three-frame-layout-and-scroll-view/) a good link, hope it helps you. – Antrromet Jul 13 '12 at 10:00

2 Answers2

11

Try this

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/ic_launcher" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:src="@drawable/ic_launcher" />

</RelativeLayout>

Output

enter image description here

MAC
  • 15,659
  • 8
  • 53
  • 95
5

Use FrameLayout.

As per Google Blogspot Sample

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ImageView  
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 

        android:scaleType="center"
        android:src="@drawable/golden_gate" />

    <TextView
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginBottom="20dip"
        android:layout_gravity="center_horizontal|bottom"

        android:padding="12dip"

        android:background="#AA000000"
        android:textColor="#ffffffff"

        android:text="Golden Gate" />

</FrameLayout>

Which will give you following output

enter image description here

Just tweak it to suit your needs.

Vipul
  • 31,716
  • 7
  • 69
  • 86