Android Training preparation Data UI some similarities between controls and controls some similar properties differ

Source: Internet
Author: User

This blog mainly collects the differences between some of the similar controls and controls in the top five layouts

What's the difference between ImageView ImageButton Button?

(1) button inherits from Textview,imageview inherited from View,imagebutton inherits from ImageView

(2) The button supports the Android:text property, while ImageButton and ImageView are not supported, but ImageView and ImageButton support ANDROID:SRC properties, and button does not support

ImageView What is the difference between the SRC attribute and the background attribute?

(1) The background is stretched according to the length and width given by the ImageView component, while SRC stores the size of the original and does not stretch. SRC is the picture content (foreground), BG is the background and can be used simultaneously.

(2) ScaleType only works on SRC; BG can set transparency

What is the difference between gravity and layout_gravity?

(1) Gravity controls the position of the control inside the view, such as a relativelayout containing a button, setting the Gravity property to control the position of the text in the button.

(2) Layout_gravity control is the relative position of the view skill relative to the immediate parent class, such as a relativelayout containing a button, setting layout_ The Gravity property controls whether it is itself on the left side of Relativelayout, on the right or the top, or below.

The difference between margin and padding?

(1) Padding is an inner border, which refers to the inner content of the control, such as the margins of the text/picture distance from the control

(2) margin is an outer border, which refers to the margin of the control from the edge parent control

Visibility property visible,invisible. The difference between gone?

(1) Visible: The settings control is visible,

(2) INVISIBLE: The settings control is not visible, the view still occupies the allocated layout space in the XML file

(3) GONE: The settings control is not visible, the view does not occupy the layout control that is assigned in the XML file, and the control behind the top

The difference between fill_parent and match_parent?

(1) From the beginning of the Android2.2 Fill_parent renamed to Match_parent, it is recommended to use match_parent, because it is estimated that no one now use Android2.2 below the Android phone now

Android Training preparation Data UI some similarities between controls and controls some similar properties differ

Related Article

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.