Rahul Thakur
Rahul Thakur

Reputation: 932

ImageView vs ImageButton vs Button

In my layout, I have some images that are to be the button background (no text). I am confused to how I should go about it. There are a few options to achieve this -

  1. Button
  2. ImageButton
  3. ImageView

Personally, I prefer the ImageView so I can scale the images appropriately and then set onClickListener.

Am I missing something or are there performance issues with my approach? Pros and Cons of each will help a lot.

Thanks & Regards

R

Upvotes: 6

Views: 4405

Answers (1)

reidisaki
reidisaki

Reputation: 1524

There are a lot of in-depth answers to the question but the 3 main differences in my opinion are

  1. Button - 3d rendering of a button that has text.
  2. ImageButton - 3d rendeirng of a button but instead of text you are using an image.
  3. ImageView - a flat image.

ImageButton and Button have the pressed,selected, focused, unselected states that can convey to the user the different states of the button.

I don't believe there are any performance benefits of using one vs, the other but there are definitely UI and UX reasons to use each one. ImageView I would assume would be good to display just the image. Users won't really know that they can click on the Image.. but with the button counterparts users are trained that they should click on them.

Upvotes: 8

Related Questions