效果如图:
刚開始是单独做了个button。发现无法调margin,后来想到外面套一个布局
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingRight="8dp" > <Button android:layout_gravity="center_vertical" android:id="@+id/widget_bt_done" android:text="@string/done" style="@style/Rounded_DarkBlue_FiveDegree_MenuButton"/> </LinearLayout>
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/menu_edit_done" android:title="@string/done" android:actionLayout="@layout/widget_done_button" android:showAsAction="always" /> </menu>
<style name="Rounded_DarkBlue_FiveDegree_MenuButton"> <item name="android:background">@drawable/rounded_corner_button_dark_blue_five_degree</item> <item name="android:layout_height">33dp</item> <item name="android:layout_width">wrap_content</item> <item name="android:textColor">@color/defaultWhite</item> </style>