The Holo Dev The Holo Dev - 6 months ago 20
Android Question

Android borderless buttons

I hate to be the third person to ask this, but the previous two askings haven't seemed to answer it fully. The android design guidelines detail borderless buttons, but not how to make them. In one of the previous answers, there was a sugestion to use:

style="@android:style/Widget.Holo.Button.Borderless"


This works well for a Holo theme, but I use a lot of Holo.Light as well and

style="@android:style/Widget.Holo.Light.Button.Borderless"


Does not seem to exist. Is there a way to apply a style for such borderless buttons in Holo.Light, or better yet, simply apply a borderless tag without specifying which theme it belongs in, so the app can pick the proper style at runtime?

Holo.ButtonBar seems to fit the bill for what I am looking for, except it provides no user feedback that it's been pressed.

Also, is there a place in the documentation that lists such styles that can be applied and a description of them? No matter how much I google, and search through the docs, I can't find anything. There is just a non-descriptive list if I right click and edit style.

Any help would be appreciated.

Edit: Got a perfect answer from javram, and I wanted to add some XML for anyone interested in adding the partial borders google has adopted.

Fora horizontal divider, this works great

<View
android:id="@+id/horizontal_divider_login"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="@color/holo_blue" />


and this for a vertical one:

<View
android:id="@+id/vertical_divider"
android:layout_width="1dip"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/holo_blue" />

Answer

Check out my answer here. In a nutshell the correct solution is to use the following:

android:background="?android:attr/selectableItemBackground"