Skip to content

Instantly share code, notes, and snippets.

@kodamirmo
Last active September 17, 2015 17:51
Show Gist options
  • Save kodamirmo/893ad8b959df2aab88d2 to your computer and use it in GitHub Desktop.
Save kodamirmo/893ad8b959df2aab88d2 to your computer and use it in GitHub Desktop.
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:background="@drawable/fondo_boton"/>
<!-- fondo_boton, es el nombre del archivo XML donde pusiste las imagenes -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- La imagen "button_imagen1" es la que muestra cuando tiene el foco -->
<item android:drawable="@drawable/button_imagen1" android:state_selected="true" />
<!-- La imagen "button_imagen2" es la que muestra cuando se presiona -->
<item android:drawable="@drawable/button_imagen2" android:state_pressed="true" />
<!-- La imagen "button_imagen3" es la que muestra en el estado normal -->
<item android:drawable="@drawable/button_imagen3" />
</selector>
<!-- Este archivo lo tienes que guardar en la carpeta "drawable" -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment