Document directory
Gridlayout
Getting started
Sizes, margins and alignment/gravity
Flexibility
Emulating features from other layouts
The phases of the layout operation
Conclusion
10 November 2011
Http://android-developers.blogspot.com/2011/11/new-layout-widgets-space-and-gridlayout.html
New layout widgets: space and gridlayout
[This post is by Philip Mil
Original: Android 0 basic Introductory section 32nd: New GridLayout Grid layoutThe main study in this issue is the grid layout is the new Android 4.0 layout, and the previous Tablelayout table layout is a bit similar, but he has a lot of former things, but also more useful.I. Understanding GridLayoutThe grid layout realizes the interleaved display of the control,
Android GridLayout layout, androidgridlayout
A GridLayout is added after android4.0. It uses virtual line to divide the layout into rows, columns, and cells. It also supports the staggered arrangement of controls on rows and columns. In fact, it uses methods and LinearLayout, relativelayout is similar, but it only has some special attributes.
The layout policy of
1.GridLayoutWebsiteGridLayout contains the following properties :Android:alignmentmodeProperty Description: When the alignmargins is set, the outer bounds of the view are calibrated. You can take the following values:Alignbounds--The subassembly view boundary.Alignmargins--The subassembly view margin.Android:columncountProperty Description: Maximum number of columns for GridLayoutAndroid:rowcountProperty Description: Maximum number of rows for GridLayoutAndroid:columnorderpreservedProperty Descr
Layout of android ----- GridLayout (grid layout) and android grid layout
Learning Map
(1) Introduction
Grid layout is represented by GridLayout. The layout manager is added after android4.0. Therefore, it must be used in Versions later than android4.0. If you use the layout manager on earlier platforms, you need to i
component occupies the space of its owning grid
Android:layout_column
Set the component in the first column of the container
Android:layout_row
Set the component line in the container
Android:layout_columnspan
The Setup component occupies several columns
Android:layout_rowspan
The Setup component occupies a few lines
The layoutgravity here is a bit different from the general layout
In Android 4.0 (API 14), a completely new component GridLayout, which inherits from LinearLayout, is used for the layout of the Web format.In some ways, GridLayout is similar to Tablelayout and the GridView. His strong point is that you can specify that each cell "spans" several cells or "vertically" several cells, which is similar to the Several important proper
Introduction to Android GridLayout, Calculator for exampleAndroid GridLayout Default horizontal layout element from left to right. You can control whether the orientation of the child element layout is horizontal or vertical by setting the property: Android:orientation=.The GridLayout properties Android:layout_row a
parent width, put a few buttons, the remaining space width will be filled with the second column, the code is as follows:Shrinkcolumns Shrinking columnsandroid:shrinkColumns="1"Indicates that the contents of the second column are shrunk, if the width of the screen is not inclusive, the second column will be shrunk, that is, flattened, elongated. Like the code to modify, add more content, so that its text content beyond the screen bar!GridLayout Grid
The Grid layout label is GridLayout. This layout is a new layout for android4.0. This layout is only available after 4.0 versions.
But some new stuff.
① like LinearLayout (linear layout), he can set the alignment of a component in a container
Components in a ② container can span multiple rows or across multiple columns (compared to tablelayout, which takes up a single line of components)
Because it's Android
addition, if a cell needs to occupy multiple locations, it can be set using Android:layout_rowspan and Android:layout_columnspan.The biggest problem with GridLayout is that the space occupied by the entire table is indeterminate, and the line spacing is determined by the height of the largest cell in the row, which is determined by the cell with the widest range of columns. In the above example, some of the controls are outside the screen. The size o
---------------------------------------------------------------------Android GridLayout How to let 4 textview evenly fill the layout interfaceAndroid:layout_rowweightAndroid:layout_rowweightshould be able to achieve the results you want, but they are only supported in the new version of the API.Finally my solution is to use Tablelayout, which inherits from LinearLayout, and can use the Layout_weight propert
About GridLayout
Before the android4.0 version, if you want to achieve the grid layout, consider using the most common linearlayout layouts, but there are several problems with this arrangement:
1, can not be at the same time in the direction of the x,y axis control alignment.2, when the multi-layer layout nesting will have performance problems.3, not stable support for a number of tools to support the free editing of the layout.
Second, consider u
First introduce the common layout class
Framelayout The simplest layout manager.
This layout management class has several features:
Add components by default in the upper-left corner.
If you add multiple components, they are stacked together and are in the upper-left corner. ( You can change the overlay by a gravity attribute )
After adding the components in the upper layer.
LinearLayout LinearLayout is laid out vertically and horizontally, LinearLayout allows each v
The problem arises [2013-01-11 10:52:39-GRIDLAYOUT_V7] Unable to resolve target ' android-7 ' cause: At one time to do nine Gongge. The GridLayout layout was mistakenly used. So Eclipse took the initiative to download for me?? Gridlayout_v7_2 file and put it in the workspace folder.Because it is no longer necessary, but also for the clarity of the folder structure, you need to delete it. But when you close
Effect chart
train of thought: is to set the number of GridLayout first, and then put a certain number of custom Calendar button control, the last implementation of the calendar logic can be.
Steps:
First step: Customize the Calendar control (Preliminary)
Step Two: Implement custom single Date button controls
Step three: Add the control from the second step dynamically to the layout of the first step and implement the date logic
Fourth step: W
GridLayout and gridlayout
Preface:
As a new layout after android 4.0, it is a little similar to the TableLayout (table layout) introduced earlier;
However, some new things are added.
① Like LinearLayout (linear layout), it can set the alignment of components in the container.
② Components in the container can span multiple rows or multiple columns (the co
New UI-layout-GridLayout (grid layout) details, ui-gridlayout
New UI-layout-GridLayout (grid layout)
-- Reprinted please indicate the source: coder-pig. You are welcome to repost it. Please do not use it for commercial purposes!
The piggy Android development and exchange group has been established. You are welcome t
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.