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

后端 未结 5 1737
一向
一向 2021-02-01 12:14

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

5条回答
  •  再見小時候
    2021-02-01 12:22

    The differences can be subtle. The most direct way to understanding this is to start with looking at the docs. If you look at the docs for Button you can see that Button is derived from TextView. ImageButton on the other hand is derived from ImageView. So fundamentally, a Button can have text and is clickable, whereas an ImageButton is a bit more flexible in how you set the image. It has methods from its ImageView base class like setImageURI which a Button does not. One of the differences between these two and just a plain ImageView is that you can have button states which is explained in both of the Button and ImageButton docs.

提交回复
热议问题