S'il vous plaît vérifier le lien à l'image ci-dessous. Je suis incapable de poster l'image en raison de la mauvaise réputation.Comment faire pour que ImageView flotte au-dessus d'un LinearLayout?
http://i.stack.imgur.com/nupZo.png
Mon but est d'obtenir une mise en page comme celui de gauche et à la place que je suis obtenir celui de droite. Voici mon code xml pour la mise en page.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:background="@color/metalDark"
android:orientation="vertical"
>
<LinearLayout
android:id="@+id/topPanel"
android:layout_width="fill_parent"
android:layout_height="65dp"
android:background="@color/metalList"
android:elevation="6dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
.../>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/topPanel"
android:layout_margin="10dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/albumheader"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="@color/metalList"
android:elevation="6dp">
<LinearLayout
android:id="@+id/underlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
android:layout_marginBottom="25dp"
android:background="@drawable/canvas2">
<ImageView
android:id="@+id/al_art"
android:layout_width="135dp"
android:layout_height="135dp"
android:layout_toLeftOf="@+id/al_details"
android:layout_marginLeft="25dp"
android:layout_marginTop="-17dp"
android:elevation="4dp"/>
<LinearLayout
android:id="@+id/al_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right|center"
android:orientation="vertical">
<TextView
.../>
<TextView
.../>
<TextView
.../>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/metalList"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:elevation="6dp"
>
<ListView
..../>
</LinearLayout>
</LinearLayout>
Merci monsieur. Ça a marché. Mais s'il vous plaît dites-moi pourquoi avez-vous gardé le layout_height du RelativeLayout à 0? Et la hauteur du rectangle orange va-t-elle changer en fonction du périphérique et de la taille de l'écran? –
Aussi, si je veux mettre des textes à l'intérieur du rectangle orange, comment puis-je m'assurer qu'il reste à l'intérieur? –
J'ai mis à jour la réponse pour inclure vos questions. – Sherlock