Css3 flexible box model flex Quick Start and get started (align-content and align-items), css3align-content
Next we will continue with the Quick Start and getting started with the css3 flexible box model flex above. There are still two attributes of the parent container align-items and align-content.
1. align-content: multi-row sub-axis alignment
Description
Multi-row sub-axis alignment
Optional Value
stretch | flex-start | cen
other type of repetitive labor loss problems, consult your physician and try again. If you want to do it, you should take it easy to start and don't feel it hurts. Stretching should not hurt, but may be slightly uncomfortable. If you feel pain, it is stretching too much ..
You actually want to relax each time you stretch. This is a bit difficult to explain, but it is not to force your joints to a fixed position, but to reach a position first, think a
to Margin-left (left) and Margin-top (top).
Translate3d (x, y, z)
Define a 2D conversion, x: Horizontal displacement, Y: vertical Displacement, z:z direction displacement
TranslateX (x)
Define a horizontal direction 2D conversion
Translatey (y)
Define a vertical direction 2D conversion
Translatez (z)
Define a Z-direction 3D conversion
Scale (x, y)
Define a 2D stre
, respectively:
Adaptation of mobile phone layout (default): Res/layout/main.xml
Fit size >7-inch flat layout: Res/layout/main_pb.xml
Then add the following two files, and the system will automatically choose which layout profile to use according to the Android version.
Fit with Android 3.2 flat layout
res/values-large/layout.xml
The above two configuration files do not really define the layout, they simply set main to the @layout/main_pb alias.
If this is not done, the conte
equal.
space-around: The intervals on each side of the item are equal. Therefore, the interval between items is one times larger than the interval between items and borders.
3.5 Align-items Propertiesalign-itemsproperty defines how the item is aligned on the intersection axis.
{ align-items: Flex-start | flex-end | center | baseline | stretch;}
It may take 5 values. The specific alignment is related to the direction o
.flex-flowFunction: Shorthand form ofFlex-direciton and flex-wrap{ flex-flow: ;}4.justify-contentFunction: Define the alignment of the project on the spindle{ justify-content: flex-start | flex-end | center | space-between | space-around; }
Flex-start (default): Left Justified
Flex-end: Right-justified
Center: Center
Space-between: Justified, the interval between items is equal.
Space-around: The intervals on each side of the item are equal. Therefore, the interva
the hemispherical body, and they look like a black border.
Rain
Based on the Raindrop effect we see, let's try to make a separate raindrop effect.
HAML
. container
. Window
. Raindrop
Scss
$drop-width:15px;
$drop-stretch:1.1;
$drop-height: $drop-width* $drop-stretch;
raindrop{
Position:absolute;
Top: $height/2;
Left: $width/2;
Width: $drop-width;
Height: $drop-height;
bor
GridBagLayout is one of the most important Java layout manager, can make a very complicated layout, can say GridBagLayout is must learn,
GridBagLayoutClass is a flexible layout manager that does not require the same size of components to align components vertically, horizontally, or along their baselines.
Each GridBagLayout object maintains a dynamic rectangular cell grid, and each component occupies one or more such units, which are called display areas .
Here is a Notepad case to illustrate
Addsubview:button];
Run:As you can see, the effect is very poor. The reason is very simple, because the original size is 24x60, and now the entire picture is stretched to 150x50, the more serious is the 4 corners of the picture.Some people may immediately think of a solution, you call the artist to enlarge the picture is not good, how to stretch all right. Yes, it's a solution, but it's not recommended. The reason is simple: 1. The picture is large,
picture 17 [button Setbackgroundimage:image Forstate:uicontrolstatenormal]; 18 19 // add button 20 [Self.view Addsubview:button];21} Run:As you can see, the effect is very poor. The reason is very simple, because the original size is 24x60, and now the entire picture is stretched to 150x50, the more serious is the 4 corners of the picture. Some people may immediately think of a solution, you call the artist to enlarge the picture is not good, how to
parameters are as follows:
Scalex: True/false: whether to stretch the X axis. The default value is true.
Scaley: True/false: whether to stretch the Y axis. The default value is true.
Scalecontent: True/false indicates whether to stretch the child element of an element. The default value is true.
Scalefromcenter: True/false indicates whether to u
the development of the upload UI, if the background size is different, you usually need to create an image for each size, which is particularly evident in the button. Of course, we can also make a small horizontal duplicate, or vertical. In Android, when there is an nine patch image (ending with 9.png) to solve the difference in the background size, only one background image is used.
Use the built-in tools \ draw9patch. BAT to open a PNG image. We can draw a black line with pixel width in the o
.
123
{ display: - Webkit-flex; display flex
View Rawgistfile1.cssthis Gist brought to your by GitHub.All examples in this article will have a corresponding browser vendor prefix.Each child element in a telescopic container is a scaling project. The scaling project can be any number. All elements inside and outside the telescopic container are unaffected. Simply put, Flexbox defines how the scaling items in the telescopic container should b
Addsubview:button];
Run:As you can see, the effect is very poor. The reason is very simple, because the original size is 24x60, and now the entire picture is stretched to 150x50, the more serious is the 4 corners of the picture.Some people may immediately think of a solution, you call the artist to enlarge the picture is not good, how to stretch all right. Yes, it's a solution, but it's not recommended. The reason is simple: 1. The picture is large,
Because the project needs to do screen adaptation, and a lot of original pictures, the original words are from other programs ba La down, and now a lot of their own, so must consider how to do, and to ensure that the layout will not be messyNeedless to say, the film production method, avoid people go too many detoursIn fact, the Android SDK with the image of the production tool, if it is used by the artist, you also need to configure the Java environment, not configured, it seems to be useless,
borders.
Align-items:flex-start | Flex-end | Center | Baseline | stretch;/* the top and bottom of the alignment */
Flex-start: The start of the vertical axis is aligned.
Flex-end: The end alignment of the vertical axis.
Center: The midpoint alignment of the vertical axis.
Baseline: The baseline alignment of the first line of text for the item.
Stretch (default): If the item is
can see, the effect is very poor. The reason is very simple, because the original size is 24x60, and now the entire picture is stretched to 150x50, the more serious is the 4 corners of the picture.Some people may immediately think of a solution, you call the artist to enlarge the picture is not good, how to stretch all right. Yes, it's a solution, but it's not recommended. The reason is simple: 1. The picture is large, resulting in the installation p
, where the baseline default is the first line of text, that is first baseline , all sub-containers are aligned to the baseline, and the sub-container with the largest cross-axis start-to-element baseline distance will be retransmitting with the intersection to determine the baseline.
Stretch: The dimensions of the sub-containers are stretched along the cross-axis direction to match the parent container.
1.2 Sub-containers
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.