Partage
  • Partager sur Facebook
  • Partager sur Twitter

[Android] Réaliser un layout complexe

Image à l'appui

Sujet résolu
    10 septembre 2013 à 15:44:53

    Bonjour !

    J'aimerais savoir comment refaire en android cette image : http://static6.businessinsider.com/image/5213bdedecad04ed7c000016-1200/zappos-has-made-finding-the-right-shoes-and-getting-them-to-your-door-a-cinch-from-anywhere-with-their-wonderful-app-on-android.jpg

    Plus précisemment le dernier layout si possible. Si vous avez des idées, sachant que j'ai tout dans une base de données, à mettre dans le layout ensuite (informations et images).

    Merci beaucoup !

    • Partager sur Facebook
    • Partager sur Twitter
      17 septembre 2013 à 11:08:36

      la barre du haut est une action bar, tu devras donc ajouter tes éléments depuis le fichier xml du menu.


       

      le code ci-dessous montre un exemple pour l'image ci dessous, il te reste a completer pour els autres parties.

      Ce code fonctionne avec des pourcentages, une fois que tu auras bien préciser les tailles, le rendu sera pratiquement le même sur tous les équipements android (pas de taille définies éxplicitement, que des pourcentages):

       

      <?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:orientation="vertical"
          android:weightSum="90">
          
          <!-- partie du haut -->
          <LinearLayout 
      	    android:layout_width="match_parent"
      	    android:layout_height="0dip"
      	    android:layout_weight="30"
      	    android:orientation="horizontal"
      	    android:weightSum="100">
      	    
          	<!-- partie gauche -->
              <LinearLayout 
      		    android:layout_width="0dip"
      		    android:layout_weight="80"
      		    android:layout_height="match_parent"
      		    android:orientation="vertical"
      		    android:weightSum="4">
      		    <TextView 
      			    android:layout_width="match_parent"
      			    android:layout_height="0dip"
      			    android:layout_weight="1"
      			    android:id="marque"
      		        />
      		    <TextView 
      			    android:layout_width="match_parent"
      			    android:layout_height="0dip"
      			    android:layout_weight="1"
      			    android:id="model"
      		        />
      		    <LinearLayout 
      			    android:layout_width="match_parent"
      			    android:layout_height="0dip"
      			    android:layout_weight="1"
      			    android:orientation="horizontal">
      				    <TextView 
      					    android:layout_width="match_parent"
      					    android:layout_height="0dip"
      					    android:layout_weight="1"
      					    android:id="nombre_de_notes"
      				        />
      				    <RelativeLayout 
      					    android:layout_width="1px"
      					    android:layout_height="match_parent"
      					    android:background="#EDEDED"/> <!-- trait de séparation -->
      				    <ImageView 
      					    android:layout_width="match_parent"
      					    android:layout_height="0dip"
      					    android:layout_weight="1"
      					    android:id="etoiles"
      				        />
      			</LinearLayout>
      		    <TextView 
      			    android:layout_width="match_parent"
      			    android:layout_height="0dip"
      			    android:layout_weight="1"
      			    android:id="prix"
      		        />
              </LinearLayout>
              <RelativeLayout 
      		    android:layout_width="1px"
      		    android:layout_height="match_parent"
      		    android:background="#EDEDED"/> <!-- trait de séparation -->
              <!-- partie droite -->
              <LinearLayout 
      		    android:layout_width="0dip"
      		    android:layout_weight="20"
      		    android:layout_height="match_parent"
      		    android:orientation="vertical"
      		    android:weightSum="1">
      		    
      		    <ImageView 
      			    android:layout_width="match_parent"
      			    android:layout_height="0dip"
      			    android:layout_weight="1"
      			    android:id="commentaires"
      		        />
                  <RelativeLayout 
      			    android:layout_width="match_parent"
      			    android:layout_height="1px"
      			    android:background="#EDEDED"/> <!-- trait de séparation -->
      			    
      		    <ImageView 
      			    android:layout_width="match_parent"
      			    android:layout_height="0dip"
      			    android:layout_weight="1"
      			    android:id="favoris"
      		        />
      			<RelativeLayout 
      			    android:layout_width="match_parent"
      			    android:layout_height="1px"
      			    android:background="#EDEDED"/> <!-- trait de séparation -->
      			    
      		    <ImageView 
      			    android:layout_width="match_parent"
      			    android:layout_height="0dip"
      			    android:layout_weight="1"
      			    android:id="infos"
      		        />
      		</LinearLayout>
          </LinearLayout>
          
          <!-- selection taille couleur ... -->
          <LinearLayout 
      	    android:layout_width="match_parent"
      	    android:layout_height="0dip"
      	    android:layout_weight="15"
      	    android:orientation="horizontal"></LinearLayout>
          
          <!-- image de la chaussure -->
          <ImageView 
      	    android:layout_width="match_parent"
      	    android:layout_height="0dip"
      	    android:layout_weight="40"></ImageView>
          
          <!-- boutons ... -->
          <LinearLayout 
      	    android:layout_width="match_parent"
      	    android:layout_height="0dip"
      	    android:layout_weight="5"
      	    android:orientation="horizontal"></LinearLayout>
      
      </LinearLayout>
      

      -
      Edité par freetibet 17 septembre 2013 à 11:10:37

      • Partager sur Facebook
      • Partager sur Twitter

      [Android] Réaliser un layout complexe

      × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
      × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
      • Editeur
      • Markdown