2012-07-13 33 views
7

Tengo una pregunta bastante simple: necesito poner un pequeño logo sobre un ImageView, grande toda la pantalla, en el área inferior derecha de la pantalla, pero no sé cómo establecer las coordenadas o cómo decir que ImageViews esté en una posición relativa.Android, ImageView sobre ImageView

Algo como esto:

enter image description here

+0

Puede consultar FrameLayout. [Heres] (http://mobileorchard.com/android-app-development-%E2%80%93-layouts-part-three-frame-layout-and-scroll-view/) un buen enlace, espero que te ayude . – Antrromet

Respuesta

8

probar este

<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> 

salida

enter image description here

+0

Gracias, probé esto y funcionó en el primer intento – Stefano

+0

¡RelativeLayout es la clave! estaba usando el diseño lineal. – ThunderWiring

2

Uso FrameLayout.

Según Google Blogspot Muestra

<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> 

que le dará siguiente salida

enter image description here

Sólo ajustar para que se adapte a sus necesidades.