2010-09-28 11 views
0

J'ai la disposition suivante. Cela définit une ligne dans ma ListView. J'ai remarqué que le texte n'est pas centré dans la rangée. Il semble y avoir un rembourrage supplémentaire. Comment puis-je faire apparaître le texte au centre, verticalement, donc il n'y a pas de remplissage?Pourquoi y a-t-il un rembourrage supplémentaire au bas de ma rangée?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" android:background="@drawable/stocks_gradient"> 
    <TextView 
     android:id="@+id/nameText" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:text="Symbol" android:textStyle="bold" android:textSize="24sp" android:layout_width="100dp" android:textColor="#4871A8" android:paddingLeft="5dp"/> 
    <TextView 
     android:id="@+id/priceText" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/nameText" 
     android:gravity="right"  
     android:text="100" android:textStyle="bold" android:textSize="24sp" android:textColor="#4871A8"/> 
    <TextView 
     android:id="@+id/changeText" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/priceText" 
     android:gravity="right"  
     android:textSize="18sp" android:text="3.07(+1.08%)" android:padding="7dip"/> 
</RelativeLayout> 

Répondre

0

Avez-vous essayez de régler le layout_gravity à center_vertical? En outre, vous pouvez avoir une raison de le faire, mais la disposition que vous montrez serait beaucoup plus simple en tant que LinearLayout horizontal. Il n'y a pas besoin de RelativeLayout ici.