Basic knowledge required for Android layout: android Layout
Eclipse environment variable Configuration:
1. In eclipse, choose Window --> preferences --> Android (Android can be viewed only when ADT is installed) --> SDK Location: import the SDK path
2. Configure platform-tools and tools in the sdk directory to the Path of the environment variable.
& Cmd command: adb (check whether the environment is configured for android) and java (check whether the environment is configured for java)
& Configure java environment variables: configure the bin directory in JDK to Environment Variables
Connection of the night god simulator: (To prevent disconnection)
Configure the bin directory of the path for installing the night god simulator to the environment variables. Cmd enter the command nox_adb connect 127.0.0.1: 62001
Load the xml layout to the Activity interface:
SetContentView (R. layout. MainActivity );
All android UI components and basic attributes common to the UI layout manager.
DrawableTop: Set the image to the top of the text
DrawableBottom: Set the image to the bottom of the text
DrawableLeft: Set the image to the left of the text
DrawableRight: Set the image to the right of the text
DrawablePadding
Visibility visible
Gravity sets the position inside the component & equivalent to the padding
&&Gravity_layout& Limited to linear layout Components
Padding (internal distance of the component)
Margin (external distance of the component)
Common attributes of TextView:
AutoLink sets text as a hyperlink
Lines sets the number of lines of text
Ellipsize: when the content exceeds the text, the subsequent content is not displayed.
SingleLine
Typeface font format external import font
Common attributes of RelativeLayout relative layout:
Align with the parent form: 3 + 4 (the attribute value is true or false)
Layout_centerVertical vertical center
Layout_centerHorizontal horizontal center
Layout_centerInparent parent layout centered
Layout_alignParentLeft left alignparentleft
Layout_alignParentRight: Right alignparentright of the parent form
Layout_alignParentTop alignparenttop
Layout_alignBottom is aligned under the parent form
Align with other components: 4 + 4 (the property value must be the reference value of id. For example, to align with the component whose id is btn: "@ id/btn ")
Layout_toLeftOf is located on the left of a component
Layout_toRight is located on the right of a component
Layout_abve is located on top of a component
Layout_below is located under a component
Layout_alignLeft is aligned with the left edge of a component.
Layout_alignRightAlign with the right edge of a component
Layout_alignTopAlignment relative to the upper edge of a component
Layout_alignBottomAlign with the lower edge of a component
Tags:
Include: Import another layout file to the current file (layout reuse ). Format:<Include layout = "@ layout/xm_name">
Note:
1. The <include/> label can use the layout attribute separately to introduce the layout, which is also a required attribute.
2. The <include/> label overwrites the label that introduces layout. The premise is to write the layout_width and laytout_height attributes.
3. The layout can contain two identical include labels.
Merge: (No attribute layout) is used as the root layout. When include is used, the layout level is reduced (the level should not exceed 4 ).
ViewStub:Dynamic Loading
Table layout TableLayout:
Attribute: TableRow indicates a row.
Feature: you do not need to specify the height and width. You can use the weight (weight) to adjust it.
&: Weights are often used in linear layout and table layout.
Grid layout (GridLayout)
Attribute: columnCount: Set grid layout Columns