Android button background color Android button background color android android

Android button background color


If you want to keep the general styling (rounded corners etc.) and just change the background color then I use the backgroundTint property

android:backgroundTint="@android:color/holo_green_light"


This is my way to do custom Button with different color.`

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" ><stroke android:width="3dp"        android:color="#80FFFFFF" />  <corners android:radius="25dp" />  <gradient android:angle="270"            android:centerColor="#90150517"            android:endColor="#90150517"            android:startColor="#90150517" /></shape>

This way you set as background.

<Button android:id="@+id/button"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="Button"        android:layout_marginBottom="25dp"        android:layout_centerInParent="true"        android:background="@drawable/button"/>


If you don't mind hardcoding it you can do this ~> android:background="#eeeeee" and drop any hex color # you wish.

Looks like this....

<Button    android:id="@+id/button1"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_alignParentLeft="true"    android:layout_alignParentRight="true"    android:layout_below="@+id/textView1"    android:text="@string/ClickMe"    android:background="#fff"/>