I was just checking the design guidelines and wondering about the borderless buttons. I goggled and tried to find in the source but can't bring it together by myself. Is this the normal Button widget but you add a custom (Android default) style? How to make these borderless buttons (of course you can set the background to empty, but then I don't have the divider)?
Here links to the design guidelines:
If you want to achieve the same programmatically :
(this is C# but easily transatable to Java)
Match
For material style add
style="@style/Widget.AppCompat.Button.Borderless"
when using the AppCompat library.Simply add the following style attribute in your
Button
tag:source: http://developer.android.com/guide/topics/ui/controls/button.html#Borderless
Then you can add dividers as in Karl's answer.
For anybody who's still searching:
inherit your own style for Holo buttonbars:
or Holo Light:
and for borderless Holo buttons:
or Holo Light:
Another solution that should work on both older and newer android platform is to use
attribute for Button view. But after adding above line button will not provide touch feedback.
To provide touch feedback add the following code to Activity class
Its working fine for me.
To clear some confusion:
This is done in 2 steps: Setting the button background attribute to android:attr/selectableItemBackground creates you a button with feedback but no background.
The line to divide the borderless button from the rest of you layout is done by a view with the background android:attr/dividerVertical
For a better understanding here is a layout for a OK / Cancel borderless button combination at the bottom of your screen (like in the right picture above).