views:

71

answers:

2

I am trying to replace my previous ugly text button with an imagebutton. However, after changing the XML file with the following ImageButton code, my application won't even start. Why?

<ImageButton 
android:layout_height="fill_parent"
     android:id="@+id/refresh"
android:src="@drawable/refresh"              
 /> 
A: 

It turned out that I forgot the layout_width attribute. It works now.

<ImageButton 
        android:layout_height="fill_parent"
        android:id="@+id/refresh"
        android:src="@drawable/refresh"     
        android:layout_width="wrap_content"      
    /> 
Yang
+1  A: 

specify the layout width..

android:layout_width="wrap_content/*some value ex:50dp*/" 
Kantesh