Skip to content

Instantly share code, notes, and snippets.

@thedoapps
Created January 13, 2015 22:08
Show Gist options
  • Save thedoapps/551dac01900ad0f76343 to your computer and use it in GitHub Desktop.
Save thedoapps/551dac01900ad0f76343 to your computer and use it in GitHub Desktop.
Como customizar un boton en android, usando selector xml.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Estado Presionado -->
<item android:state_pressed="true">
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="10dp" />
<solid android:color="@color/red_oficial" />
</shape>
</item>
<item android:bottom="5dp">
<shape android:shape="rectangle">
<corners android:radius="10dp" />
<solid android:color="@color/red_oficial" />
</shape>
</item>
</layer-list>
</item>
<!-- Estado Normal -->
<item>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="10dp" />
<solid android:color="@color/red_oficial" />
</shape>
</item>
<item android:bottom="3dp">
<shape android:shape="rectangle">
<corners android:radius="10dp" />
<solid android:color="@color/red_normal" />
</shape>
</item>
</layer-list>
</item>
</selector>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment