Question

J'ai utilisé ce code de sélection pour mon bouton personnalisé (simple.xml)

  <?xml version="1.0" encoding="utf-8"?>

  <selector xmlns:android="http://schemas.android.com/apk/res/android">
      <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/focused" />
      <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/focusedpressed" />
      <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/pressed" />
      <item android:drawable="@drawable/defaultbutton" />
  </selector>

Mais sur mon ImageButton Je ne sais pas comment supprimer la frontière. Je veux montrer que mes images ne pas montrer la frontière autour du bouton.

Merci text alt

Était-ce utile?

La solution

Je REMPLACER

    <ImageButton android:id="@+id/imagebutton"
  android:src="@drawable/simple"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  />

avec:

    <ImageButton android:id="@+id/imagebutton"
  android:background="@drawable/simple"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  />

Et le travail

Autres conseils

Définir android:background plutôt que android:drawable.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top