Android:按钮对齐

Android:按钮对齐,android,Android,您好,我很难让这个按钮看起来很好,我可以用普通的xml文件还是使用样式 下面是我的xml代码 <Button android:id="@+id/cancelbtn" android:textSize="18sp" android:layout_marginLeft="2dip" android:layout_width="wrap_content" android:layout_height="45dip"

您好,我很难让这个按钮看起来很好,我可以用普通的xml文件还是使用样式

下面是我的xml代码

<Button
        android:id="@+id/cancelbtn"
        android:textSize="18sp"
        android:layout_marginLeft="2dip"
        android:layout_width="wrap_content"
        android:layout_height="45dip"
        android:layout_weight="1.0"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:text="Cancel"
        android:textColor="#000000" />
<Button
        android:id="@+id/startbtn"
        android:background=""
        android:textColor="#000000" 
        android:layout_alignTop="@+id/fbcancel"
        android:layout_toLeftOf="@+id/fbcancel"
        android:textSize="18sp"
        android:layout_marginRight="2dip"
        android:layout_width="wrap_content"
        android:layout_height="45dip"
        android:layout_weight="1.0"
        android:text="Start" />


“开始”按钮高度大,宽度小。由于按钮文本中显示的字符数不同,因此无法精确设置为“取消”按钮。 您需要为按钮指定固定的宽度和高度


请参阅解决问题的链接。

从两个按钮和
android:layout\u weight=“1.0”
中删除android:layout\u alignTop=“@+id/fbcancel”从“开始”按钮中删除
=“45dip”android:layout\u weight=“1.0”将其删除,然后重试。@Carl Saldanha当我在设备中看到它时,开始按钮比取消按钮小得多,并且它们不是完全相同的直线。因此,尝试使布局高度包裹内容,而不是45 dip删除android:layou\u alignTop=“@+id/fbcancel“使开始按钮移动到不同的位置现在两个按钮的大小是否相同?如果是,请添加安卓:layout\u alignParentBottom=“true”以开始按钮没有按钮的大小不一样,canel很好,但开始按钮太小,只有取消按钮的一半