android: id identity
android: id = "@ + id / name" to create an id
android: layout_width width
Width layout_width = "wrap_content" adaptive content: android
android: layout_width = "match_parent" parent matching the width of the space
android: layout_height height
android: layout_height = "520dp" use dp units
android: margin Margin
android: padding padding inside
android: paddingLeft = within "20dp" left margin
android: Right margins within paddingRight
android: padding on paddingTop
android: padding within the next paddingBottom
android: background background
android: background = "# 000000" black background
android: orientation direction
android: orientation = "vertical" the direction perpendicular to
android: orientation = "horizontal" horizontal direction
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.administrator.myapplication.MainActivity" android:background="#00ff55" android:orientation="vertical"> <LinearLayout android:id="@+id/L1" android:layout_width="200dp" android:layout_height="300dp" android:background="#000000" android:orientation="vertical" android:layout_margin="30dp" android:padding="20dp" > <LinearLayout android:id="@+id/L2" android:background="#ffffff" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> </LinearLayout> </LinearLayout> <LinearLayout android:id="@+id/L3" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="20dp" android:background="#ff0000" android:orientation="vertical" > </LinearLayout> </LinearLayout>
效果图