views:

54

answers:

2

Hi,

I used this selector code for my custom button (simple.xml)

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

  <selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      <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>

But on my ImageButton I don't know how to remove border. I want to show only my images not to show border around button.

Thanks alt text

+1  A: 

Set android:background rather than android:drawable.

David Hedlund
I replace android:drawable="@drawable/focused" with android:background="@drawable/focused" , but I get force close error. Thanks
Jovan
In xlm file I use :<ImageButton android:id="@+id/imagebutton" android:src="@drawable/simple" android:layout_width="wrap_content" android:layout_height="wrap_content" />
Jovan
Can you give me code? Thanks
Jovan
A: 

I replace

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

with :

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

And work

Jovan