• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Circle Button in Android

Zarquad

Lurker
I'm new to android development, so bear with me. I'm trying to use a circular image (I don't know if it's a perfect circle, if that matters) as a button, but when I set it as the background the image is on top of a black box. How do I get rid of the black edges?

Screenshot of picture in windows photo viewer (to show that it's transparent): http://i.gyazo.com/a5f668781dcf7b4479134b7e61b0e141.png

Screenshot of problem: http://i.gyazo.com/a7f3b25341ebf4146d294df1f5660e99.png

Fragment main xml:
Code:
 <ImageButton
          android:id="@+id/hardButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:background="@drawable/hard_button_img"
        android:onClick="hardButton" />



This is the hard button xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/hard_button_img" android:state_focused="true" android:state_pressed="false"/>
    <item android:drawable="@drawable/hard_button_img" android:state_focused="true" android:state_pressed="true"/>
    <item android:drawable="@drawable/hard_button_img"/>

</selector>
 
Back
Top Bottom