SlideShare ist ein Scribd-Unternehmen logo
1 von 14
ConstraintLayout:
Why and how to use
Farhan Rahman Arnob • 21.01.2018
Overview
● ConstraintLayout allows you to create
large and complex layouts with a flat
view hierarchy (no nested view
groups).
● It's similar to RelativeLayout in that all
views are laid out according to
relationships between sibling views
and the parent layout, but it's more
flexible than RelativeLayout and
easier to use with Android Studio’s
Layout Editor.
WHY CONSTRAINT LAYOUT?
Reason
● A flat view hierarchy. Shallow
layout load fast!
● Easy modification.
● Time efficient update.
● Drag-and-dropping instead of
editing the XML.
HOW TO CREATE BASIC CONSTRAINT LAYOUT
View’s height/width mode:
1. Wrap Content: The view
expands only as much as
needed to fit its contents.
2. Fixed: You specify a specific
dimension
3. The view expands as much as
possible to meet the
constraints on each side
HOW TO CREATE BASIC CONSTRAINT LAYOUT
Basic Criteria:
● To define a view's position,
must add at least one
horizontal and one vertical
constraint for the view.
HOW TO CREATE BASIC CONSTRAINT LAYOUT
Guideline:
● want to allocate resource
space based on percentage
or split screen into a
dimension .
● If you click on red you get
different mode like
percentage, left fixed, right
fixed.
● Two types: vertical &
Horizontal
HOW TO CREATE BASIC CONSTRAINT LAYOUT
Barrier:
● want to create a barrier
based on multiple view’s
position range, use this.
● Here, View C got reposition
due to max length from A &
B.
HOW TO CREATE BASIC CONSTRAINT LAYOUT
Align:
● If you want to align based on
view do like like this.
● To create left align connect
child’s left point with parent’s
left point. & for right align
connect right points.
● For center align, connect left
and right both.
HOW TO CREATE BASIC CONSTRAINT LAYOUT
Baseline alignment(Text
align):
● If you want to align text use
text use this.
● One click on selected view
and you will get “ab” option.
Click “ab” and you will get
baseline bar. By drag and
drop you can connect to base
lines.
HOW TO CREATE BASIC CONSTRAINT LAYOUT
Constraint bias:
● When you add a constraint to
both sides of a view , the view
becomes centered between
the two constraints with a
bias(5) of 50% by default.
HOW TO CREATE BASIC CONSTRAINT LAYOUT
Chain layout:
● A chain is a group of views
that are linked to each other
with bi-directional position
constraints.
● Select both views (shift +
click) and then click right
button. Chin option will
appear.
● Can chain two to more.
HOW TO CREATE BASIC CONSTRAINT LAYOUT
Aspect Ratio:
● Useful for image view.
● Click on ratio enable bar (1).
Ratio box (4) will open.
● Need at least one match
parent(2) in vertically or
horizontally.
For more information
Visit: https://codelabs.developers.google.com/codelabs/constraint-layout/
Any Question?
Last conversation about this slide
Thank you

Weitere ähnliche Inhalte

Ähnlich wie Constraint layout - Cutting edge Android layout design

Margin vs Padding.pdf
Margin vs Padding.pdfMargin vs Padding.pdf
Margin vs Padding.pdfWebMaxy
 
WMP_MP02_revd_03(10092023).pptx
WMP_MP02_revd_03(10092023).pptxWMP_MP02_revd_03(10092023).pptx
WMP_MP02_revd_03(10092023).pptxfahmi324663
 
Advanced CSS.pptx
Advanced CSS.pptxAdvanced CSS.pptx
Advanced CSS.pptxDiyonaVas
 
Dreamweaver cs6 step by step
Dreamweaver cs6 step by stepDreamweaver cs6 step by step
Dreamweaver cs6 step by stepzoran Jelinek
 
Mobile Programming - 3 Rows, Column and Basic Sizing
Mobile Programming - 3 Rows, Column and Basic SizingMobile Programming - 3 Rows, Column and Basic Sizing
Mobile Programming - 3 Rows, Column and Basic SizingAndiNurkholis1
 
Adobe InDesign Primer
Adobe InDesign PrimerAdobe InDesign Primer
Adobe InDesign PrimerNYCCTfab
 
Net4’s EasySite Builder Step by Step Guide
Net4’s EasySite Builder Step by Step GuideNet4’s EasySite Builder Step by Step Guide
Net4’s EasySite Builder Step by Step GuidePallavi Vyas
 
Net4’s EasySite Builder Step By Step Guide to Create Business Website
Net4’s EasySite Builder Step By Step Guide to Create Business WebsiteNet4’s EasySite Builder Step By Step Guide to Create Business Website
Net4’s EasySite Builder Step By Step Guide to Create Business WebsiteNet4 India Ltd.
 
Day 4 android bootcamp
Day 4  android bootcampDay 4  android bootcamp
Day 4 android bootcampFatimaYousif11
 
pdfcoffee.com_pathloss-5-pdf-free.pdf
pdfcoffee.com_pathloss-5-pdf-free.pdfpdfcoffee.com_pathloss-5-pdf-free.pdf
pdfcoffee.com_pathloss-5-pdf-free.pdfDenissShala
 
Techniques of structuring your presentation
Techniques of structuring your presentationTechniques of structuring your presentation
Techniques of structuring your presentationDr. Anshu Raj Purohit
 

Ähnlich wie Constraint layout - Cutting edge Android layout design (20)

Auto Layout on Xcode 5
Auto Layout on Xcode 5Auto Layout on Xcode 5
Auto Layout on Xcode 5
 
Ui 5
Ui   5Ui   5
Ui 5
 
Margin vs Padding.pdf
Margin vs Padding.pdfMargin vs Padding.pdf
Margin vs Padding.pdf
 
WMP_MP02_revd_03(10092023).pptx
WMP_MP02_revd_03(10092023).pptxWMP_MP02_revd_03(10092023).pptx
WMP_MP02_revd_03(10092023).pptx
 
Page layout with css
Page layout with cssPage layout with css
Page layout with css
 
Advanced CSS.pptx
Advanced CSS.pptxAdvanced CSS.pptx
Advanced CSS.pptx
 
Dreamweaver cs6 step by step
Dreamweaver cs6 step by stepDreamweaver cs6 step by step
Dreamweaver cs6 step by step
 
Mobile Programming - 3 Rows, Column and Basic Sizing
Mobile Programming - 3 Rows, Column and Basic SizingMobile Programming - 3 Rows, Column and Basic Sizing
Mobile Programming - 3 Rows, Column and Basic Sizing
 
Adobe InDesign Primer
Adobe InDesign PrimerAdobe InDesign Primer
Adobe InDesign Primer
 
Html frames
Html framesHtml frames
Html frames
 
Net4’s EasySite Builder Step by Step Guide
Net4’s EasySite Builder Step by Step GuideNet4’s EasySite Builder Step by Step Guide
Net4’s EasySite Builder Step by Step Guide
 
Net4’s EasySite Builder Step By Step Guide to Create Business Website
Net4’s EasySite Builder Step By Step Guide to Create Business WebsiteNet4’s EasySite Builder Step By Step Guide to Create Business Website
Net4’s EasySite Builder Step By Step Guide to Create Business Website
 
Android ppt.pptx
Android ppt.pptxAndroid ppt.pptx
Android ppt.pptx
 
Lecture2 CSS 3
Lecture2   CSS 3Lecture2   CSS 3
Lecture2 CSS 3
 
Day 4 android bootcamp
Day 4  android bootcampDay 4  android bootcamp
Day 4 android bootcamp
 
Power BI.pdf
Power BI.pdfPower BI.pdf
Power BI.pdf
 
pdfcoffee.com_pathloss-5-pdf-free.pdf
pdfcoffee.com_pathloss-5-pdf-free.pdfpdfcoffee.com_pathloss-5-pdf-free.pdf
pdfcoffee.com_pathloss-5-pdf-free.pdf
 
RULERS
RULERSRULERS
RULERS
 
layout and UI.pptx
layout and UI.pptxlayout and UI.pptx
layout and UI.pptx
 
Techniques of structuring your presentation
Techniques of structuring your presentationTechniques of structuring your presentation
Techniques of structuring your presentation
 

Kürzlich hochgeladen

Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 

Kürzlich hochgeladen (20)

Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 

Constraint layout - Cutting edge Android layout design

  • 1. ConstraintLayout: Why and how to use Farhan Rahman Arnob • 21.01.2018
  • 2. Overview ● ConstraintLayout allows you to create large and complex layouts with a flat view hierarchy (no nested view groups). ● It's similar to RelativeLayout in that all views are laid out according to relationships between sibling views and the parent layout, but it's more flexible than RelativeLayout and easier to use with Android Studio’s Layout Editor.
  • 3. WHY CONSTRAINT LAYOUT? Reason ● A flat view hierarchy. Shallow layout load fast! ● Easy modification. ● Time efficient update. ● Drag-and-dropping instead of editing the XML.
  • 4. HOW TO CREATE BASIC CONSTRAINT LAYOUT View’s height/width mode: 1. Wrap Content: The view expands only as much as needed to fit its contents. 2. Fixed: You specify a specific dimension 3. The view expands as much as possible to meet the constraints on each side
  • 5. HOW TO CREATE BASIC CONSTRAINT LAYOUT Basic Criteria: ● To define a view's position, must add at least one horizontal and one vertical constraint for the view.
  • 6. HOW TO CREATE BASIC CONSTRAINT LAYOUT Guideline: ● want to allocate resource space based on percentage or split screen into a dimension . ● If you click on red you get different mode like percentage, left fixed, right fixed. ● Two types: vertical & Horizontal
  • 7. HOW TO CREATE BASIC CONSTRAINT LAYOUT Barrier: ● want to create a barrier based on multiple view’s position range, use this. ● Here, View C got reposition due to max length from A & B.
  • 8. HOW TO CREATE BASIC CONSTRAINT LAYOUT Align: ● If you want to align based on view do like like this. ● To create left align connect child’s left point with parent’s left point. & for right align connect right points. ● For center align, connect left and right both.
  • 9. HOW TO CREATE BASIC CONSTRAINT LAYOUT Baseline alignment(Text align): ● If you want to align text use text use this. ● One click on selected view and you will get “ab” option. Click “ab” and you will get baseline bar. By drag and drop you can connect to base lines.
  • 10. HOW TO CREATE BASIC CONSTRAINT LAYOUT Constraint bias: ● When you add a constraint to both sides of a view , the view becomes centered between the two constraints with a bias(5) of 50% by default.
  • 11. HOW TO CREATE BASIC CONSTRAINT LAYOUT Chain layout: ● A chain is a group of views that are linked to each other with bi-directional position constraints. ● Select both views (shift + click) and then click right button. Chin option will appear. ● Can chain two to more.
  • 12. HOW TO CREATE BASIC CONSTRAINT LAYOUT Aspect Ratio: ● Useful for image view. ● Click on ratio enable bar (1). Ratio box (4) will open. ● Need at least one match parent(2) in vertically or horizontally.
  • 13. For more information Visit: https://codelabs.developers.google.com/codelabs/constraint-layout/ Any Question? Last conversation about this slide