Comment aligner un TextView à droite avec LinearLayout

J'ai deux textView objets que j'utilise pour afficher le résultat du calcul dans mon application. Ils sont en train d'apparaître à la droite de la TextView donc je voulais savoir si il y a un chemin à travers le fichier xml à la position de la TextView vers la droite. C'est mon code xml:

<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="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context="com.jtryon.rectanglecalc.MainActivity$PlaceholderFragment" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/width_string"
android:textSize="16sp"
android:textStyle="bold" />
<EditText
android:id="@+id/width_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"      
android:inputType="numberDecimal" > 
<requestFocus />
</EditText>       
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >  
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/height_string"
android:textSize="16sp"
android:textStyle="bold" /> 
<EditText
android:id="@+id/height_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="numberDecimal" />     
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold" 
android:text="@string/area_string" />
<TextView
android:id="@+id/area_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/perim_string"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold"
android:text="@string/perim_string" />
<TextView
android:id="@+id/perim_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp" />
</LinearLayout>    
</LinearLayout>

Comment aligner un TextView à droite avec LinearLayout

  • Pourriez-vous être un peu plus clair? Peut-être une image de ce que vous voulez? Je sais que vous voulez un de ces nombreux TextViews pour le droit à quelque chose...
InformationsquelleAutor JimT | 2014-04-24