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:
This is how you create a borderless (flat) button programmatically without using XML
Look into the theme attributes
buttonBarStyle
,buttonBarButtonStyle
, andborderlessButtonStyle
.Late answer, but many views. As APIs < 11 ain't dead yet, for those interested here is a trick.
Let your container have the desired color (may be transparent). Then give your buttons a selector with default transparent color, and some color when pressed. That way you'll have a transparent button, but will change color when pressed (like holo's). You can also add some animation (like holo's). The selector should be something like this:
And the button should have
android:background="@drawable/selector_transparent_button"
PS: let you container have the dividers (
android:divider='@android:drawable/...
for API < 11)PS [Newbies]: you should define those colors in values/colors.xml
Use the below code in your xml file. Use android:background="#00000000" to have the transparent color.
You can make buttons borderless through code as well:
For those who want to create borderless button programmatically for API's >= 8