Android 对齐文本视图、按钮、编辑文本

Android 对齐文本视图、按钮、编辑文本,android,alignment,Android,Alignment,如何将文本视图和按钮向左对齐,将编辑文本和按钮向右对齐?下面是包含未对齐项的表单 我的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:l

如何将文本视图和按钮向左对齐,将编辑文本和按钮向右对齐?下面是包含未对齐项的表单

我的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>


您只需将其放入textview即可

android:paddingLeft="4dp"
但我建议你检查一下这个问题

我觉得它看起来很整齐。你们能更具体一点,更详细地看一下“P”字母和按钮的左框吗