En alignant un TextView et ImageView à l'intérieur d'un LinearLayout

J'ai une ListView avec adaptateur personnalisé et une mise en page pour les éléments de cette Liste. La mise en page des articles est juste un TextView avec une ImageView. L'image doit être aligné sur le côté droit de l'écran. Cependant, la position de l'image se décale un peu, en fonction de la longueur du texte dans le TextView. C'est à quoi il ressemble:

En alignant un TextView et ImageView à l'intérieur d'un LinearLayout

C'est mon code XML:

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

    <TextView
        android:id="@+id/txtCategoryName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="10"
        android:singleLine="true"
        android:ellipsize="end"
        android:gravity="center_vertical"
        android:paddingTop="5dp"
        android:paddingBottom="5dp"
        android:textColor="@color/list_text_color"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <ImageView
        android:id="@+id/imgArrowRight"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/right_arrow_44"
        android:contentDescription="@string/img_description_right_arrow"
        android:layout_gravity="right" />

</LinearLayout>

Comment puis-je faire de l'image sera toujours aligné à droite, sans être poussé?

OriginalL'auteur Igal | 2012-10-28