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
This code will remove all background for a button:
android:background="@android:color/transparent"
At the risk of beating a dead horse, here's another (possibly better) option. AppCompat v7 defines a borderless button style. If you're already making use of the AppCompat library, just go with that:
<Button android:text="@string/borderlessButtonText" style="@style/Widget.AppCompat.Button.Borderless" />
Just incase anybody is looking for light-weight solution to get the borderless button for the API's that do not support the Holo theme (like I did for a long time), Im posting my solution below:
<View
android:layout_height="1dp"
android:layout_width="match_parent"
android:background="#505154"
android:layout_marginLeft="10dp" android:layout_marginRight="10dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/btn_Reply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="@android:color/transparent"
android:paddingBottom="15dp" android:paddingTop="15dp"
android:textColor="#5c5966"
android:text="@string/btnReplyText"/>
<View
android:layout_height="fill_parent"
android:layout_width="1dp"
android:background="#505154"
android:layout_marginBottom="7dp" android:layout_marginTop="7dp"/>
<Button
android:id="@+id/btn_Delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingBottom="15dp" android:paddingTop="15dp"
android:textColor="#5c5966"
android:background="@android:color/transparent"
android:text="@string/btnDeleteText" />
<View
android:layout_height="fill_parent"
android:layout_width="1dp"
android:background="#505154"
android:text="@string/btnReplyText"
android:layout_marginBottom="7dp" android:layout_marginTop="7dp" />
<Button
android:id="@+id/btn_Exit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:text="@string/btnExitText"
android:paddingBottom="15dp" android:paddingTop="15dp"
android:textColor="#5c5966"
android:background="@android:color/transparent"/>
</LinearLayout>
All you have to do is change the colours and text to suit your own background. All the best!
Check out my answer here. In a nutshell the correct solution is to use the following:
android:background="?android:attr/selectableItemBackground"
Simply add the following style attribute in your Button
tag:
style="?android:attr/borderlessButtonStyle"
source: http://developer.android.com/guide/topics/ui/controls/button.html#Borderless