第一種寫法: 使用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="20d第二種寫法: 使用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)
新聞熱點
疑難解答