Java Android-将按钮与editview对齐稍微关闭

Java Android-将按钮与editview对齐稍微关闭,java,android,android-layout,layout,Java,Android,Android Layout,Layout,我想要一个按钮,以对齐的底部和右侧的编辑文本框 我的代码如下: <RelativeLayout android:id="@+id/global_only_available_home_delivery_postcode_check_layout" android:layout_width="match_parent" android:orientation="horizontal" android:layout_marginTop="5dp" and

我想要一个按钮,以对齐的底部和右侧的编辑文本框

我的代码如下:

<RelativeLayout
    android:id="@+id/global_only_available_home_delivery_postcode_check_layout"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_marginTop="5dp"
    android:layout_gravity="right"
    android:layout_height="wrap_content" >

    <EditText
        android:id="@+id/global_only_available_home_delivery_postcode_check_text_phone"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="@string/delivery_edit_hint"
        android:layout_marginLeft="@dimen/pdp_status_delivery_margin_5"
        android:layout_marginTop="@dimen/pdp_status_delivery_margin_10"
        android:textSize="14sp"
        android:inputType="text" />
     <Button
        android:id="@+id/fragment_pdp_deliverygo"
        style="@style/alternatesmallbutton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minWidth="35dp"
        android:minHeight="35dp"
        android:layout_marginLeft="10dp"
        android:text="@string/pdp_delivery_go"
        android:layout_gravity="right"
        android:layout_margin="5dp"
        android:layout_toRightOf="@+id/global_only_available_home_delivery_postcode_check_text_phone"
        android:layout_alignBottom="@+id/global_only_available_home_delivery_postcode_check_text_phone"
        android:visibility="visible" />
</RelativeLayout>

这就是我得到的

从图中可以看到,按钮似乎没有与textview的底部对齐

有人能帮忙吗?

试试这个

使用
android:layout\u alignParentRight=“true”
android:layout\u centerVertical=“true”


这是因为按钮有
android:layout\u margin=“5dp”
。这将为按钮底部指定一个
5dp
的边距,它看起来好像没有与底部对齐。如果需要,您应该将其删除并将边距单独分配给其他边,例如:

android:layout_marginRight="5dp"
android:layout_marginTop="5dp" // etc (optional)

尝试使用下面的布局而不是布局对齐底部

遗憾的是,它不起作用,我仍然发现按钮在底部没有对齐。这很奇怪,因为在图形视图中,它对齐得很好,但在应用程序中却没有
android:layout_marginRight="5dp"
android:layout_marginTop="5dp" // etc (optional)