Skip to content

Instantly share code, notes, and snippets.

@kurorido
Created April 16, 2016 07:43
Show Gist options
  • Save kurorido/455bc2293e9320498f59bd7d3a55039e to your computer and use it in GitHub Desktop.
Save kurorido/455bc2293e9320498f59bd7d3a55039e to your computer and use it in GitHub Desktop.
Android button different state background
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="false"
android:drawable="@drawable/title_button_back">
</item>
<item
android:state_pressed="true"
android:drawable="@drawable/title_button_back_h">
</item>
<item
android:state_window_focused="false"
android:drawable="@drawable/title_button_back">
</item>
</selector>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<ImageButton
android:id="@+id/title_IB" ;
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="#00000000"
android:layout_marginRight="4dp"
android:layout_centerVertical="true"
android:src="@drawable/selector"> ;
</ImageButton>
</RelativeLayout>
@kurorido
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment