第一种写法:
使用paddding和margin来做按钮之间的间隔
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#88000000" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/layout_camera"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/line_bottom"
android:clickable="true"
android:paddingBottom="20dip"
android:paddingTop="20dip" >
<TextView
style="@style/PhotoDemo.TextView._Black"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:drawablePadding="20dp"
android:gravity="center"
android:text="@string/pop_photo" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/layout_choose"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/line_bottom"
android:clickable="true"
android:paddingBottom="20dip"
android:paddingTop="20dip" >
<TextView
style="@style/PhotoDemo.TextView._Black"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:drawablePadding="20dp"
android:gravity="center"
android:text="@string/pop_choose" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/layout_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/line_bottom"
android:clickable="true"
android:paddingBottom="20dip"
android:paddingTop="20dip" >
<TextView
style="@style/PhotoDemo.TextView._Black"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:drawablePadding="20dp"
android:gravity="center"
android:text="@string/pop_cancel" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
第二种写法:
使用TextView来做两个Button之间的间隔
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_transparent" >
<LinearLayout
android:id="@+id/ll_popup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#ffffff"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ff495a" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal" >
<Button
android:id="@+id/item_popupwindows_camera"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@drawable/bt_nobgd"
android:textColor="#585858"
android:textSize="18sp"
android:text="拍照" />
</LinearLayout>
<TextView
android:layout_marginLeft="80dp"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#f2f2f2" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal" >
<Button
android:id="@+id/item_popupwindows_Photo"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@drawable/bt_nobgd"
android:textColor="#585858"
android:textSize="18sp"
android:text="从相册中选取" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#f3f3f3" />
<Button
android:id="@+id/item_popupwindows_cancel"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@drawable/bt_nobgd"
android:textColor="#585858"
android:textSize="18sp"
android:text="取消" />
</LinearLayout>
</RelativeLayout>
FR:海涛高软(QQ技术交流群:386476712)