-2

J'ai une listview dans un RelativeLayout. La taille de mon relativelayour changer selon la taille de ma listview (nombre de lignes). S'il n'a que deux lignes, la disposition relative reste plus grande. S'il a plus de lignes, le parent reste plus petit.ListView sont augmentation relativelayout taille

Cela se produit uniquement dans les petits appareils.

Que dois-je faire?

EDIT: CODE CI-DESSOUS

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/bg_cinza_transparente_98_porcento" 
android:orientation="vertical" 
tools:context=".AdicionarMarcaModeloActivity" > 

<LinearLayout 
    style="@style/..." 
    android:layout_width="match_parent" 
    android:background="@color/cinza_escuro" 
    android:orientation="vertical" > 

    <RelativeLayout 
     style="@style/..." 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+id/labelCabecalhoMarcaModelo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_centerVertical="true" 
      android:text="Marca" 
      android:textColor="@android:color/white" 
      android:textSize="22sp" /> 

     <ImageView 
      android:id="@+id/imgCloseMarcaModelo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_centerVertical="true" 
      android:layout_marginLeft="16dp" 
      android:src="@drawable/bt_close" /> 

    </RelativeLayout> 

    <RelativeLayout 
     style="@style/..." 
     android:layout_width="match_parent" 
     android:background="@color/branco_gelo" 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+id/labelSubCabecalhoMarcaModelo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_centerVertical="true" 
      android:text="SELECIONE A MARCA DO SEU VEÍCULO" 
      android:textColor="@color/cinza_escuro_fontes_cabecalho" /> 

    </RelativeLayout> 

</LinearLayout> 

<RelativeLayout 
    style="@style/..." 
    android:layout_width="match_parent" 
    android:orientation="horizontal" > 

    <ListView 
     android:id="@+id/lvMarcaModelo" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:divider="@drawable/line" > 
    </ListView> 

</RelativeLayout> 

+0

s'il vous plaît ajouter votre fichier xml – Natali

+0

et style @/Pesos_Marca_Modelo_Corpo s'il vous plaît – Natali

+0

Les styles sont les suivants: 80 pour le relativelayout et 20 pour le linéaire secont mise en page – Roland

Répondre

1
// Try this way,hope this will help you to solve your problem... 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 


     <TextView 
      android:id="@+id/labelCabecalhoMarcaModelo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Marca" 
      android:textColor="@android:color/white" 
      android:layout_gravity="center_horizontal" 
      android:textSize="22sp" /> 

     <ImageView 
      android:id="@+id/imgCloseMarcaModelo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="16dp" 
      android:src="@drawable/ic_launcher" 
      android:layout_marginTop="5dp"/> 


     <TextView 
      android:id="@+id/labelSubCabecalhoMarcaModelo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal" 
      android:text="SELECIONE A MARCA DO SEU VEÍCULO" 
      android:layout_marginTop="5dp"/> 


    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:layout_marginTop="5dp"> 

     <ListView 
      android:id="@+id/lvMarcaModelo" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:divider="@drawable/line" > 
     </ListView> 

    </LinearLayout> 
</LinearLayout> 
Questions connexes