Difference between Button with image, ImageButton, and clickable ImageView?

Snake picture Snake · Feb 23, 2012 · Viewed 28.7k times · Source

Is there any difference between Button with image, ImageButton and clickable ImageView?

Answer

Frank Sposaro picture Frank Sposaro · Feb 23, 2012

This probably only covers part of the differences, it would be helpful to actually look at the Android Source tree to see exactly what's going on.

ImageButtons has push states, where as a clickable image does not. You also can't call setText for ImageButton, you can with a regular button.

They all derive from view, but looking at the following extends chain may help a little.

java.lang.Object
↳ android.view.View
   ↳ android.widget.ImageView
       ↳ android.widget.ImageButton

versus

java.lang.Object
↳ android.view.View
   ↳ android.widget.TextView
       ↳ android.widget.Button