Wednesday, November 6, 2013

Four. Gravity


Part 3. TableLayout + ScrollView
Squares of different sizes (depending on whether, tan for certain things inside size / shape decision) containers are placed on the screen,
1. Child in LinearLayout of horizontal / vertical alignment: orientation LinearLayout element's android: orientation property to "horizontal" (horizontal) or "vertical" tan (perpendicular) to the custom. On LinearLayout instance of the Java code. SetOrientation (LinearLayout.HORIZONTAL or LinearLayout.VERTICAL) use.
Container or inside a container element, using the properties of the child android: layout_width (horizontal size) and android: layout_height (vertical size) specified by the following values. "Constant + Unit": Specifies the size of the widget that directly. (Ex. "50px", "123in", etc.) "wrap_content": tan myself (Container / widgets) that contains the information (content) as snug against the size of the set itself. "Fill_parent": containing his set to fill the parent container to fill a tight setting.
Four. Gravity
android: gravity inside the magnetic specifies the location of their content. For example, look at a picture of the bottom of the widget TextView A is represented by the white area, and that their content is in the area of "Text A" string to the right, you can see that ssolryeo. Android_gravity property of the TextView A "right" is set to be. (Note that in TextView android: gravity attribute by setting the text of the Left, Center, Right, Up / Down, center alignment can be set)
On the other hand, android: layout_gravity property that contains their own position within the parent container is specified. For example, in the figure below, the full area of TextView B is shown in green, and the location of the parent container when in P B can be seen that the right ssolryeo. TextView B of the android: layout_gravity attribute set to "right" is because.
android: gravity or android: layout_gravity The following properties can be set to the same value. When setting multiple values | use. (Ex. right | bottom) top: the top of the container object to push the limits. No changes in the size of the object. bottom: the object under the container to push the limits. No changes in the size of the object. left: the object to the left of the container push the limits. No changes in object size. right: the right to the limit push the container object. No changes in object size. center_vertical: an object placed in the vertical center of the container. No changes in size. fill_vertical: expanding the object up and down up and down as high as the container becomes tan full deployment. center_horizontal: an object placed in the horizontal center of the container. No changes in size. fill_horizontal: a container object by expanding the width from side to side as full, place the left and right. center: Object of the container vertically / horizontally placed in the center. No changes in size. fill: the size of the container as an object vertically / horizontally tan expanded to fill the container completely full that. clip_vertical: up and down the length of the object is larger than the container. Undercut popping up and down. top | clip_vertical tan cases that pop up at the bottom tan of the cut object load. bottom | clip_vertical cases cut off at the top of the protruding object load. center_vertical | clip_vertical cases, down, cut off all protruding parts. clip_horizontal: a container object is larger than the length of the left and right, right and left protruding undercut. right | clip_horizontal to the left of the protruding portion is truncated, left | clip_horizontal Yoshitsune left to right, tan cut off the protruding part. center_horizontal | clip_horizontal the container from side to side undercut all the protruding parts.
Five. Padding tan all the widgets of the widget cell (cell) can not invade the other widgets tan have a separate tan space, the widget from the inner wall of the cell to the actual widget is called the length of the padding. Space between the widget and the widget is used to set. For example, Widget A, B, all the padding 5px when placed side-by-side two, if the distance between two widgets becomes 10px. padding is described as a picture.
setOrientation (int): LinearLayout.HORIZONTAL or LinearLayout.VERTICAL passed as an argument to the LinearLayout control tan of the orientation property. setGravity (int): Gravity.LEFT / Gravity.CENTER / Gravity.RIGHT Gravity class as an argument passed to the constants defined in the gravity control the properties of the LinearLayout. setPadding (int, int, int, int): left, top, right, bottom net (left clockwise from) the int type value (in pixels) of the widget cell padding factors control the properties delivered. Using the properties of the LinearLayout inside the Java code examples (main.xml)
'Being Androider> Android Study' category of the other posts Android 010: TableLayout container / ScrollView tan (Android Container 3: TableLayout / ScrollView) (17) 2010/01/30 Android 009: RelativeLayout container (Android Container 2: RelativeLayout) (8) January 28, 2010 Android 008: LinearLayout container (Android Container 1: LinearLayout) (4) 2010/01/27 Android 007: CheckBox, RadioBox (RadioGroup), View (5) 2010/01/25 Android 006: TextView, Button , ImageView, EditText (2) 2010/01/24 Android 005: XML-based Layout System (XML based layout system) (0) 2010/01/23
TAG Android, android SDK, Container, tan gravity, layout_gravity, layout_height, layout_weight, LinearLayout, Orientation, padding, setGravity, setOrientation, weight, smart phone, Android, Android courses, container
Development environment (2)


No comments:

Post a Comment