android ImageButton gets gray background -


i have button nice background selector. fine. in stead of text in button, want image. have tried changing imagebutton src attribute. when this, looks gray background overlaid behind selector, behind src image.

when change regular button, problem goes away. want background selector, plus src image (in stead of button text).

any ideas?

imagebutton should have android:background set.

<imagebutton      android:id="@+id/ibarrow"     android:layout_width="35px"     android:layout_height="50px"     android:src="@drawable/arrow"     android:background="@drawable/backgroundstate" />    

and backgroundstate:

    <?xml version="1.0" encoding="utf-8"?>     <selector xmlns:android="http://schemas.android.com/apk/res/android">         <item android:state_selected="true" android:drawable="@color/transparent" />         <item android:state_pressed="true" android:drawable="@color/transparent" />     <item android:drawable="@color/transparent" />    </selector> 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -