Code case sharing for XML layout files

黄舟
Release: 2017-03-21 16:26:40
Original
2598 people have browsed it

XML layout file

The layout file in xml format is stored in the folder res/layout

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

Of course, there are also AbsoluteLayout, (absolute layout), FrameLayout (frame layout), etc.

They can also be nested to achieve better interface effects

I have sorted out the commonly used attributes based on my personal understanding

It may not be scientific but I think it is very practical.

Control is the whole:

android: ID address

android: width width

android: Height height

android: layout_width width (fill_parent/wrap_content)

android:layout_height (fill_parent/wrap_content)

android:layout_margin(Left/Top/Right/Bottom) Margin (*dip)

Android: Layout_weight.

android:background . Contents are displayed together (true /false)

Relative layout:

android:layout_above or but Whose bottom edge the edge is aligned with (id)

Android: Layout_toleftof to the right side to align with the left side (ID)

android: layout_torightof to the right side of the right side (ID)

android: layout_aligntop. Alignment ( ID)

Android: Layout_alignbottom. Align with. Who is the right side? The right alignment (id)

android:layout_alignParentTop The top is aligned with the top of the parent control (true/false)

android:layout_alignParentBottom The bottom is aligned with the bottom of the parent control (true/false) True/False)

android: layout_alignparentLeft left to the left side of the parent control (TRUE/FALSE)

android: Layout_alignparentrid to the right of the parent control (TR. UE/FALSE)

android: layout_centerinparent relative to the parent control (True/False)

Android: Layout_CenterHorizontal relative to the level of the parent control level (True/False)

## android: Layout_centervertical Relative to the parent control (True/False)

## ~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~

The following is the registration page I just made

                     
Copy after login

The above is the detailed content of Code case sharing for XML layout files. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!