SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Dernier

Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 

Dernier (20)

Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 

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