A few days ago I came across this again.
Here is my solution:
This is done in 2 steps: setting the background attribute of the android button : attr / selectableItemBackground creates a feedback button but does not have a background.
android:background="?android:attr/selectableItemBackground"
The line for dividing the borderless button on the rest of your layout is done using a view with android background : attr / dividerVertical
android:background="?android:attr/dividerVertical"
For a better understanding, here is the layout of the combination of OK / Cancel buttons without fields at the bottom of the screen (for example, in the right figure above).
<RelativeLayout android:layout_width="match_parent" android:layout_height="48dp" android:layout_alignParentBottom="true"> <View android:layout_width="match_parent" android:layout_height="1dip" android:layout_marginLeft="4dip" android:layout_marginRight="4dip" android:background="?android:attr/dividerVertical" android:layout_alignParentTop="true"/> <View android:id="@+id/ViewColorPickerHelper" android:layout_width="1dip" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:layout_marginBottom="4dip" android:layout_marginTop="4dip" android:background="?android:attr/dividerVertical" android:layout_centerHorizontal="true"/> <Button android:id="@+id/BtnColorPickerCancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@id/ViewColorPickerHelper" android:background="?android:attr/selectableItemBackground" android:text="@android:string/cancel" android:layout_alignParentBottom="true"/> <Button android:id="@+id/BtnColorPickerOk" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:background="?android:attr/selectableItemBackground" android:text="@android:string/ok" android:layout_alignParentBottom="true" android:layout_toRightOf="@id/ViewColorPickerHelper"/> </RelativeLayout>
KarlKarlsom Jul 14 '12 at 5:27 2012-07-14 05:27
source share