SlideShare une entreprise Scribd logo
1  sur  6
Unit 6
Practice of Layout in Application
By
Dr. Ramkumar Lakshminarayanan
Introduction
Layout becomes the basic of designing the user interface of the android application. In this
unit we discuss about the relative layout and grid layout and discuss about the design of the
User Interface.
RelativeLayout
RelativeLayout lays out elements based on their relationships with one another, and with the
parent container. This is arguably the most complicated layout, and we need several
properties to actually get the layout we want.
Relative To Container
These properties will layout elements relative to the parent container.
 android:layout_alignParentBottom – Places the bottom of the element on the bottom
of the container
 android:layout_alignParentLeft – Places the left of the element on the left side of the
container
 android:layout_alignParentRight – Places the right of the element on the right side of
the container
 android:layout_alignParentTop – Places the element at the top of the container
 android:layout_centerHorizontal – Centers the element horizontally within its parent
container
 android:layout_centerInParent – Centers the element both horizontally and vertically
within its container
 android:layout_centerVertical – Centers the element vertically within its parent
container
Relative To Other Elements
These properties allow you to layout elements relative to other elements on screen. The value
for each of these elements is the id of the element you are using to layout the new element.
Each element that is used in this way must have an ID defined using
android:id=”@+id/XXXXX” where XXXXX is replaced with the desired id. You use
“@id/XXXXX” to reference an element by its id. One thing to remember is that referencing
an element before it has been declared will produce an error.
 android:layout_above – Places the element above the specified element
 android:layout_below – Places the element below the specified element
 android:layout_toLeftOf – Places the element to the left of the specified element
 android:layout_toRightOf – Places the element to the right of the specified element
Alignment With Other Elements
These properties allow you to specify how elements are aligned in relation to other elements.
 android:layout_alignBaseline – Aligns baseline of the new element with the baseline
of the specified element
 android:layout_alignBottom – Aligns the bottom of new element in with the bottom
of the specified element
 android:layout_alignLeft – Aligns left edge of the new element with the left edge of
the specified element
 android:layout_alignRight – Aligns right edge of the new element with the right edge
of the specified element
 android:layout_alignTop – Places top of the new element in alignment with the top of
the specified element
Here is a sample XML Layout, for example we have replaced the activity_main.xml with the
following code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/an
droid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp" >
<EditText
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/reminder" />
<Spinner
android:id="@+id/dates"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/times" />
<Spinner
android:id="@id/times"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_alignParentRight="true" />
<Button
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/times"
android:layout_alignParentRight="true"
android:text="@string/done" />
</RelativeLayout>
activity_main.xml
strings.xml
Figure 6.1 Output of the learnapp using relative layout
Grid Layout
GridLayout was introduced with Android 4.0. This layout allows you to organize a
view into a Grid. GridLayout separates its drawing area into: rows, columns, and cells.
You can specify how many columns you want for define for each View in which row
and column it should be placed and how many columns and rows it should use. If not
specified GridLayout uses defaults, e.g. one column, one row and the position of
a View depends on the order of the declaration of the Views.
There is a difference between GridView and GridLayout. A GridView is a
ViewGroup that displays items in two-dimensional scrolling grid. The items in the grid come
from the ListAdapter associated with this view.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">LearnApp</string>
<string name="hello_world">Learn Android App</string>
<string name="menu_settings">Settings</string>
<string name="reminder">Your Appointment at</string>
<string name="done">Done</string>
</resources>
Because a GridView gets its data from a ListAdapter, the only data loaded in memory
will be the one displayed on screen. When ListAdapter is used as the type for your variable,
you are really interested in the interface. GridViews, much like ListViews reuse and recycle
their views for better performance.
Whereas a GridLayout is a layout that places its children in a rectangular grid.
It was introduced in API level 14, and was recently backported in the Support Library.
Its main purpose is to solve alignment and performance problems in other layouts.
The drawback of ested layouts; which fall into three basic categories:
 Inability to control alignment along both axes simultaneously
 Performance problems in hierarchies that are too deep
 Unsuitability for design tools that support free-form editing
A simple example of the first problem is the following form:
Figure 6.2 Sample Screen
As the font and the text of the “Email address” label change, we want the label to
remain aligned with the baseline of the component to its right, and aligned with
the right edge of the label below it. It’s not possible to do this with nested LinearLayouts
because the label needs to be aligned with other components both horizontally and vertically.
To provide better support a new layout is added to the Android framework:
GridLayout, which can be used to solve the above problems by dividing the container’s real
estate into rows and columns. GridLayout uses a grid of infinitely-thin lines to separate its
drawing area into: rows, columns, and cells. It supports both row and column spanning,
which together allow a widget to occupy a rectangular range of cells that are next to each
other. We’ll use the words row, column, and cell in the text below as shorthand for row
group, column group and cell group respectively, where groups have one or more contiguous
elements.
Figure 6.3 “Email address” label can belong both to a row that is baseline-aligned, and
a column that is right-aligned
Similarities with LinearLayout
In fact, the APIs are so similar that changing a tag name from LinearLayout to
GridLayout in an XML file that uses LinearLayout will often produce a similar UI without
requiring any other changes.
<?xml version="1.0" encoding="utf-8"?>
<GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:useDefaultMargins="true"
android:alignmentMode="alignBounds"
android:columnOrderPreserved="false"
android:columnCount="4">
<TextView
android:text="Email setup"
android:textSize="32dip"
android:layout_columnSpan="4"
android:layout_gravity="center_horizontal"/>
<TextView
android:text="You can configure email in just a few steps:"
android:textSize="16dip"
android:layout_columnSpan="4"
android:layout_gravity="left"/>
<TextView
android:text="Email address:"
android:layout_gravity="right"/>
<EditText
android:ems="10"/>
<TextView
android:text="Password:"
android:layout_column="0"
android:layout_gravity="right"/>
<EditText
android:ems="8"/>
<Space
android:layout_row="4"
android:layout_column="0"
android:layout_columnSpan="3"
android:layout_gravity="fill"/>
<Button
android:text="Next"
android:layout_row="5"
android:layout_column="3"
/>
</GridLayout>
The first difference you’ll notice in the code is the absence of the WRAP_CONTENT
and MATCH_PARENT constants that normally adorn Android layout resources. You don’t
normally need to use these with GridLayout.
Row and Column Indices
The second thing you may notice in the XML resources is that widgets don’t always
explicitly define which cells they are to be placed in. Each widget’s layout parameters have
row and column indices that together define where the widget should be placed but when
either or both of these values are not specified, GridLayout supplies default values rather than
throwing an exception.
Automatic Index Allocation
As children are added to a GridLayout, it maintains a cursor position and a “high-
water mark” that it uses to place widgets in cells that don’t yet have anything in them.
When GridLayout’s orientation is vertical, all of the same principles apply, except
that the roles of the horizontal and vertical axes are exchanged.
If you want multiple views to be placed in the same cell, you have to define the
indices explicitly, as the default allocation procedure above is designed to place widgets in
separate cells.
Sizes, Margins and Alignment/Gravity
In GridLayout, specifying sizes and margins is done just as with a LinearLayout.
Alignment/gravity also works just like gravity in LinearLayout and uses the same
constants: left, top, right, bottom, center_horizontal, center_vertical, center, fill_horizontal,
fill_vertical and fill.
Summary
GridLayout’s feature set incorporates much of the functionality of the Android
framework’s existing general-purpose layouts As such, it provides a way to replace many
deeply nested view hierarchies with a single highly optimized layout implementation.

Contenu connexe

Similaire à Android practice of layout in application-chapter6

Similaire à Android practice of layout in application-chapter6 (20)

Android Layout.pptx
Android Layout.pptxAndroid Layout.pptx
Android Layout.pptx
 
Android development session 3 - layout
Android development   session 3 - layoutAndroid development   session 3 - layout
Android development session 3 - layout
 
Hello Android
Hello AndroidHello Android
Hello Android
 
View groups containers
View groups containersView groups containers
View groups containers
 
行動App開發管理實務unit3
行動App開發管理實務unit3行動App開發管理實務unit3
行動App開發管理實務unit3
 
Android UI
Android UI Android UI
Android UI
 
Android Ui
Android UiAndroid Ui
Android Ui
 
Android list view tutorial by Javatechig
Android list view tutorial by JavatechigAndroid list view tutorial by Javatechig
Android list view tutorial by Javatechig
 
Android Training (Android UI)
Android Training (Android UI)Android Training (Android UI)
Android Training (Android UI)
 
Unit 2 LayoutTutorial.pptx
Unit 2 LayoutTutorial.pptxUnit 2 LayoutTutorial.pptx
Unit 2 LayoutTutorial.pptx
 
TKU行動APP開發管理實務 - ListView & Custom Adapter
TKU行動APP開發管理實務 - ListView & Custom AdapterTKU行動APP開發管理實務 - ListView & Custom Adapter
TKU行動APP開發管理實務 - ListView & Custom Adapter
 
List Views
List ViewsList Views
List Views
 
GRID VIEW PPT
GRID VIEW PPTGRID VIEW PPT
GRID VIEW PPT
 
How to create ui using droid draw
How to create ui using droid drawHow to create ui using droid draw
How to create ui using droid draw
 
Android Kotlin-Layout.pptx
Android Kotlin-Layout.pptxAndroid Kotlin-Layout.pptx
Android Kotlin-Layout.pptx
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layout
 
Building a simple user interface lesson2
Building a simple user interface lesson2Building a simple user interface lesson2
Building a simple user interface lesson2
 
Android xml-based layouts-chapter5
Android xml-based layouts-chapter5Android xml-based layouts-chapter5
Android xml-based layouts-chapter5
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfaces
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViews
 

Plus de Dr. Ramkumar Lakshminarayanan

Plus de Dr. Ramkumar Lakshminarayanan (20)

IT security awareness
IT security awarenessIT security awareness
IT security awareness
 
Basics of IT security
Basics of IT securityBasics of IT security
Basics of IT security
 
IT Security Awareness Posters
IT Security Awareness PostersIT Security Awareness Posters
IT Security Awareness Posters
 
Normalisation revision
Normalisation revisionNormalisation revision
Normalisation revision
 
Windows mobile programming
Windows mobile programmingWindows mobile programming
Windows mobile programming
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Web technology today
Web technology todayWeb technology today
Web technology today
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Phonegap for Android
Phonegap for AndroidPhonegap for Android
Phonegap for Android
 
Create and Sell Android App (in tamil)
Create and Sell Android App (in tamil)Create and Sell Android App (in tamil)
Create and Sell Android App (in tamil)
 
Android app - Creating Live Wallpaper (tamil)
Android app - Creating Live Wallpaper (tamil)Android app - Creating Live Wallpaper (tamil)
Android app - Creating Live Wallpaper (tamil)
 
Android Tips (Tamil)
Android Tips (Tamil)Android Tips (Tamil)
Android Tips (Tamil)
 
Android Animation (in tamil)
Android Animation (in tamil)Android Animation (in tamil)
Android Animation (in tamil)
 
Creating List in Android App (in tamil)
Creating List in Android App (in tamil)Creating List in Android App (in tamil)
Creating List in Android App (in tamil)
 
Single Touch event view in Android (in tamil)
Single Touch event view in Android (in tamil)Single Touch event view in Android (in tamil)
Single Touch event view in Android (in tamil)
 
Android Application using seekbar (in tamil)
Android Application using seekbar (in tamil)Android Application using seekbar (in tamil)
Android Application using seekbar (in tamil)
 
Rating Bar in Android Example
Rating Bar in Android ExampleRating Bar in Android Example
Rating Bar in Android Example
 
Creating Image Gallery - Android app (in tamil)
Creating Image Gallery - Android app (in tamil)Creating Image Gallery - Android app (in tamil)
Creating Image Gallery - Android app (in tamil)
 
Create Android App using web view (in tamil)
Create Android App using web view (in tamil)Create Android App using web view (in tamil)
Create Android App using web view (in tamil)
 
Hardware Interface in Android (in tamil)
Hardware Interface in Android (in tamil)Hardware Interface in Android (in tamil)
Hardware Interface in Android (in tamil)
 

Dernier

Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPsychicRuben LoveSpells
 
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRnishacall1
 
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Servicenishacall1
 
Leading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfLeading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfCWS Technology
 
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceDelhi Call girls
 

Dernier (6)

Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
 
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
 
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
 
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
 
Leading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfLeading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdf
 
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
 

Android practice of layout in application-chapter6

  • 1. Unit 6 Practice of Layout in Application By Dr. Ramkumar Lakshminarayanan Introduction Layout becomes the basic of designing the user interface of the android application. In this unit we discuss about the relative layout and grid layout and discuss about the design of the User Interface. RelativeLayout RelativeLayout lays out elements based on their relationships with one another, and with the parent container. This is arguably the most complicated layout, and we need several properties to actually get the layout we want. Relative To Container These properties will layout elements relative to the parent container.  android:layout_alignParentBottom – Places the bottom of the element on the bottom of the container  android:layout_alignParentLeft – Places the left of the element on the left side of the container  android:layout_alignParentRight – Places the right of the element on the right side of the container  android:layout_alignParentTop – Places the element at the top of the container  android:layout_centerHorizontal – Centers the element horizontally within its parent container  android:layout_centerInParent – Centers the element both horizontally and vertically within its container  android:layout_centerVertical – Centers the element vertically within its parent container Relative To Other Elements These properties allow you to layout elements relative to other elements on screen. The value for each of these elements is the id of the element you are using to layout the new element. Each element that is used in this way must have an ID defined using android:id=”@+id/XXXXX” where XXXXX is replaced with the desired id. You use “@id/XXXXX” to reference an element by its id. One thing to remember is that referencing an element before it has been declared will produce an error.  android:layout_above – Places the element above the specified element  android:layout_below – Places the element below the specified element
  • 2.  android:layout_toLeftOf – Places the element to the left of the specified element  android:layout_toRightOf – Places the element to the right of the specified element Alignment With Other Elements These properties allow you to specify how elements are aligned in relation to other elements.  android:layout_alignBaseline – Aligns baseline of the new element with the baseline of the specified element  android:layout_alignBottom – Aligns the bottom of new element in with the bottom of the specified element  android:layout_alignLeft – Aligns left edge of the new element with the left edge of the specified element  android:layout_alignRight – Aligns right edge of the new element with the right edge of the specified element  android:layout_alignTop – Places top of the new element in alignment with the top of the specified element Here is a sample XML Layout, for example we have replaced the activity_main.xml with the following code <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/an droid" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="16dp" android:paddingRight="16dp" > <EditText android:id="@+id/name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/reminder" /> <Spinner android:id="@+id/dates" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_below="@id/name" android:layout_alignParentLeft="true" android:layout_toLeftOf="@+id/times" /> <Spinner android:id="@id/times" android:layout_width="96dp" android:layout_height="wrap_content" android:layout_below="@id/name" android:layout_alignParentRight="true" /> <Button android:layout_width="96dp" android:layout_height="wrap_content" android:layout_below="@id/times" android:layout_alignParentRight="true" android:text="@string/done" /> </RelativeLayout>
  • 3. activity_main.xml strings.xml Figure 6.1 Output of the learnapp using relative layout Grid Layout GridLayout was introduced with Android 4.0. This layout allows you to organize a view into a Grid. GridLayout separates its drawing area into: rows, columns, and cells. You can specify how many columns you want for define for each View in which row and column it should be placed and how many columns and rows it should use. If not specified GridLayout uses defaults, e.g. one column, one row and the position of a View depends on the order of the declaration of the Views. There is a difference between GridView and GridLayout. A GridView is a ViewGroup that displays items in two-dimensional scrolling grid. The items in the grid come from the ListAdapter associated with this view. <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">LearnApp</string> <string name="hello_world">Learn Android App</string> <string name="menu_settings">Settings</string> <string name="reminder">Your Appointment at</string> <string name="done">Done</string> </resources>
  • 4. Because a GridView gets its data from a ListAdapter, the only data loaded in memory will be the one displayed on screen. When ListAdapter is used as the type for your variable, you are really interested in the interface. GridViews, much like ListViews reuse and recycle their views for better performance. Whereas a GridLayout is a layout that places its children in a rectangular grid. It was introduced in API level 14, and was recently backported in the Support Library. Its main purpose is to solve alignment and performance problems in other layouts. The drawback of ested layouts; which fall into three basic categories:  Inability to control alignment along both axes simultaneously  Performance problems in hierarchies that are too deep  Unsuitability for design tools that support free-form editing A simple example of the first problem is the following form: Figure 6.2 Sample Screen As the font and the text of the “Email address” label change, we want the label to remain aligned with the baseline of the component to its right, and aligned with the right edge of the label below it. It’s not possible to do this with nested LinearLayouts because the label needs to be aligned with other components both horizontally and vertically. To provide better support a new layout is added to the Android framework: GridLayout, which can be used to solve the above problems by dividing the container’s real estate into rows and columns. GridLayout uses a grid of infinitely-thin lines to separate its drawing area into: rows, columns, and cells. It supports both row and column spanning, which together allow a widget to occupy a rectangular range of cells that are next to each other. We’ll use the words row, column, and cell in the text below as shorthand for row group, column group and cell group respectively, where groups have one or more contiguous elements.
  • 5. Figure 6.3 “Email address” label can belong both to a row that is baseline-aligned, and a column that is right-aligned Similarities with LinearLayout In fact, the APIs are so similar that changing a tag name from LinearLayout to GridLayout in an XML file that uses LinearLayout will often produce a similar UI without requiring any other changes. <?xml version="1.0" encoding="utf-8"?> <GridLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:useDefaultMargins="true" android:alignmentMode="alignBounds" android:columnOrderPreserved="false" android:columnCount="4"> <TextView android:text="Email setup" android:textSize="32dip" android:layout_columnSpan="4" android:layout_gravity="center_horizontal"/> <TextView android:text="You can configure email in just a few steps:" android:textSize="16dip" android:layout_columnSpan="4" android:layout_gravity="left"/> <TextView android:text="Email address:" android:layout_gravity="right"/> <EditText android:ems="10"/> <TextView android:text="Password:" android:layout_column="0" android:layout_gravity="right"/> <EditText android:ems="8"/> <Space android:layout_row="4" android:layout_column="0" android:layout_columnSpan="3" android:layout_gravity="fill"/> <Button android:text="Next" android:layout_row="5" android:layout_column="3" /> </GridLayout>
  • 6. The first difference you’ll notice in the code is the absence of the WRAP_CONTENT and MATCH_PARENT constants that normally adorn Android layout resources. You don’t normally need to use these with GridLayout. Row and Column Indices The second thing you may notice in the XML resources is that widgets don’t always explicitly define which cells they are to be placed in. Each widget’s layout parameters have row and column indices that together define where the widget should be placed but when either or both of these values are not specified, GridLayout supplies default values rather than throwing an exception. Automatic Index Allocation As children are added to a GridLayout, it maintains a cursor position and a “high- water mark” that it uses to place widgets in cells that don’t yet have anything in them. When GridLayout’s orientation is vertical, all of the same principles apply, except that the roles of the horizontal and vertical axes are exchanged. If you want multiple views to be placed in the same cell, you have to define the indices explicitly, as the default allocation procedure above is designed to place widgets in separate cells. Sizes, Margins and Alignment/Gravity In GridLayout, specifying sizes and margins is done just as with a LinearLayout. Alignment/gravity also works just like gravity in LinearLayout and uses the same constants: left, top, right, bottom, center_horizontal, center_vertical, center, fill_horizontal, fill_vertical and fill. Summary GridLayout’s feature set incorporates much of the functionality of the Android framework’s existing general-purpose layouts As such, it provides a way to replace many deeply nested view hierarchies with a single highly optimized layout implementation.