First knowledge of Android

Source: Internet
Author: User

The blog has been created for a year, has not been used up, quite ashamed. Recently, the impulse to write a blog, more frightening is that the impulse seems to be more ferocious than the primitive force in my body. Thus, this blog was born quietly. Needless to say, get to the point--the first knowledge of Android.

This blog starts with the most basic knowledge.

    1. View: There are many kinds of view, display the text of the TextView, display the image of the ImageView, button buttons and so on (the content is too many, not listed).
    2. Layout: Consists of all view on the screen. Divided into LinearLayout (linear layout) and relativelayout (relative layout).

      • LinearLayout Unique Code:
        Android:orientation=horizontal/vertical    //Overall layout horizontal/Overall layout vertical android:layout_weight= "1"     //(weight set to 1) the greater the weight, The more space you get. Height (height) or weight (width) should be set to 0DP first
        ... ...
      • Relativelayout Unique Code:
        android:layout_alignparenttop= "True/false"//align with parent view Upper edge android:layout_alignparentbottom= "true/false"// Aligns with the parent view bottom edge android:layout_alignparentleft= "true/false"//Align to the left edge of the parent view android:layout_alignparentright= "True/false"// Aligns to the right edge of the parent view android:layout_centerhorizontal= "True/false"//view horizontally centered place android:layout_centervertical= "true/false"// View Vertical Center Placement
        ... ...

        In addition, relative layouts add controls to the upper-left corner of the screen by default.

  3. Each control must have a width and height.

For example:

      

4. IDE: Integrated development environment.

5. ID: Specifies the unique identity of the control, which is saved in the R file.

6. Inner Margin & margin:

      • Inner margin:
        android:padding= "8DP"    //four weeks each margin

        Subdivision: android:paddingleft= "8DP" //Left margin android:paddingright= "8DP" //Right margin android:paddingtop= "8DP" // Top margin android:paddingbottom= "8DP" //Bottom margin

 

      • Outer margin:
        Android:layout_margin= "8DP"    //four weeks each margin subdivision: android:layout_left= "8DP"    //Left margin android:layout_right= "8DP"    //Right margin android:layout_top= "8DP"    //Top margin android:layout_bottom= "8DP"    //Bottom margin

First knowledge of Android

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.