2013-02-14 8 views
0

Comment aligner TextView et Button à gauche et EditText et Button à droite? Voici le formulaire qui contient des éléments non alignés.Aligner TextView, Button, EditText

enter image description here

Mon fichier xml est:

<LinearLayout xmlns:tools="http://schemas.android.com/tools" 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/LinearLayout" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
tools:context=".MainActivity" > 

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

    <Spinner 
     android:id="@+id/spinner1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

</LinearLayout> 

<RelativeLayout 
    android:id="@+id/PlateEntryRelativeLayout" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" > 

    <Button 
     android:id="@+id/RequestButton" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:layout_below="@+id/PlateEdit" 
     android:text="@string/request" /> 

    <TextView 
     android:id="@+id/PlateTextView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBaseline="@+id/PlateEdit" 
     android:layout_alignBottom="@+id/PlateEdit" 
     android:layout_alignParentLeft="true" 
     android:text="@string/plate" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

    <EditText 
     android:id="@+id/PlateEdit" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:background="@android:drawable/editbox_background" 
     android:ems="10" 
     android:gravity="right|center_vertical" /> 

</RelativeLayout> 

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

    <ToggleButton 
     android:id="@+id/toggleButton1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:fitsSystemWindows="false" 
     android:text="ToggleButton" /> 

</LinearLayout> 

+1

Cela me semble assez bien aligné. Pourriez-vous être un peu plus précis? – akaya

+0

regardez la lettre "P" et le cadre gauche du bouton plus detailly – sanchop22

Répondre

Questions connexes