Customise button highlight color

How to customise button highlight-color
This example is disable background color when selecting

Steps

  • Prepare selector xml
  • Set button background

Prepare selector xml

This is for button status setting under(res/color/button_item.xml any directory is fine under res)

<?xml version="1.0" encoding="utf-8"?>
<selector 
  xmlns:android="http://schemas.android.com/apk/res/android">
  
  <item 
    android:state_pressed="true"
    android:drawable="@color/clear"/>
  <item android:drawable="@color/clear" />
</selector>

I also created color setting(res/values/colors.xml)

<resources>
<color name="clear">#00ffffff</color>
</resources>

Set button attr(background)

<Button android:id="@+id/listenBtn"
            android:text="@string/listen"
            android:layout_width="120dip"
            android:gravity="center"
            android:layout_height="90dip"
            style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
            android:textSize="25sp"
            android:background="@color/button_item"
            android:layout_marginRight="10dip"/>

The point is background. The value is button_item(this is setting xml)