2013-02-14 2 views
0

Как я могу выровнять свой TextView и Button слева и EditText и Button вправо? Вот форма, которая содержит не выровненные элементы.Выравнивать TextView, Button, EditText

enter image description here

Мой файл XML является:

<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

Он выглядит довольно совпадающим со мной. Не могли бы вы быть более конкретными? – akaya

+0

Посмотрите на букву «P» и левую рамку кнопки более подробно – sanchop22

ответ

Смежные вопросы