Code example of XML layout file

Source: Internet
Author: User
In the reslayout folder, layout files in xml format are mainly stored in LinearLayout (linear layout), TableLayout (table layout), RelativeLayout (relative layout), and AbsoluteLayout (absolute layout) frameLayout (frame layout) and so on can also achieve better interface effects through nesting. I sorted out common attributes according to my personal understanding, which may be unscientific, but I think it is very practical. XML layout file

Xml layout files are stored in the res/layout folder.

The layout methods include LinearLayout (linear layout), TableLayout (table layout), and RelativeLayout (relative layout)

Of course, there are also AbsoluteLayout, (absolute layout), FrameLayout (frame layout), and so on.

They can also achieve better interface effects through nesting.

I sorted out common attributes according to my personal understanding.

It may be unscientific, but I think it is very practical.

Controls are as follows:

Android: id address

Android: width

Android: height

Android: layout_width (fill_parent/wrap_content)

Android: layout_height (fill_parent/wrap_content)

Android: layout_margin (Left/Top/Right/Bottom) margin (* dip)

Android: layout_weight weight

Control content:

Android: text content

Android: textSize text size

Android: basic location of gravity content

Android: background color (RBG)

Android: padding (Left/Top/Right/Bottom) padding (* dip)

Android: singleLine peer display (true/false)

Relative layout:

Android: alignment (id) of the lower part of layout_above)

Android: layout_below align with the following (id)

Android: layout_toLeftOf alignment to the left of the person (id)

Android: layout_toRightOf align with the right of the person on the left (id)

Android: layout_alignTop aligntop)

Android: layout_alignBottom, whose bottom is aligned (id)

Android: layout_alignLeft alignleft)

Android: layout_alignRight align with the right of the person (id)

Android: layout_alignParentTop alignparenttop aligned with the parent control (true/false)

Android: layout_alignParentBottom: alignparentbottom is aligned with the parent control (true/false)

Android: layout_alignParentLeft alignparentleft (true/false)

Android: layout_alignParentRight: alignparentright (true/false)

Android: layout_centerInParent Center relative to parent control (true/false)

Android: layout_centerHorizontal align horizontally with the parent control (true/false)

Android: layout_centerVertical center vertically relative to the parent control (true/false)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The registration page I just completed is shown below

 
     
   
    
   
   
    
    
    
   
    
   
    
   
    
    
   
  
   
   
  
 

The above is the detailed content shared by the code case of the XML layout file. For more information, see other related articles in the first PHP community!

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.