Android Imageview,imagebutton with Button

Source: Internet
Author: User

1. ImageButton inherits from ImageView. Both have very small, because ImageView can also click on the corresponding, also have a click on the shadow effect. In fact their difference is the default style. For example, the same background and a picture, you will find ImageButton image will be centered, but the size does not scale. But the picture in ImageView is centered and automatically scaled by the size of the control space. The difference is caused by a parameter of ImageView: Android:scaletype= "Fitcenter", which automatically scales. The ImageButton does not automatically scale to: android:scaletype= "center".

The style of ImageButton:

 <stylename= "Widget.imagebutton">     <Itemname= "Android:focusable">True</Item>     <Itemname= "Android:clickable">True</Item>     <Itemname= "Android:scaletype">Center</Item>     <Itemname= "Android:background">@android:d Rawable/btn_default</Item> </style>

2. What is the difference between them and the Button? This is bigger because the Button inherits from TextView. That is, Button can write text, can put a background. And Imageview/imagebutton can put a background and a picture. So if we want to make a button that requires the text to be using a button, and if you need a buttons that combine an image and a background effect, use Imageview/imagebutton.

Android Imageview,imagebutton with Button

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.