SlideShare a Scribd company logo
Mobile Application
Development
Instructor:
Muhammad Jameel
Muhammad.jameel@superior.edu.pk
Outline
View, View Groups, Layouts, Layout Types, Linear Layout, Linear Layout Attributes, Linear
Layout Example, Table Layout, Absolute Layout, Frame Layout
What is View in Android App Development?
•The basic building block for user interface is
a View.
•View is created from the View class and occupies a
rectangular area on the screen.
•View is responsible for drawing and event
handling.
•View is the base class for widgets, which are used
to create interactive UI components like buttons,
text fields, etc.
View Groups in Android App Development?
• The View Group is a subclass of View and provides
invisible container that hold other Views or other View
Groups and define their layout properties.
What is Layout in Android App Development
• Layouts are subclasses of View Group class, and a typical layout defines
the visual structure for an Android user interface.
• The layout defines the visual structure of your application.
• Android Studio uses this structure to display the view elements on the
screen.
• Layouts are also called view containers.
• A layout may contain any type of views such as buttons, labels, textboxes,
and so on.
Android Studio Layout Types
• Linear Layout
• Relative Layout
• Table Layout
• Absolute Layout
• Frame Layout
• Grid Layout
• Constraint Layout
Linear Layout
• Android Linear Layout is a View Group that aligns all its
children in either vertically or horizontally.
Linear Layout Attributes
• android:id - This is the ID which uniquely identifies the layout.
• android:baselineAligned - This must be a Boolean value, either "true"
or "false" and prevents the layout from aligning its children's baselines.
• android:divider - This is drawable to use as a vertical divider between
buttons. You use a color value, in the form of "#RGB", "#ARGB",
"#RRGGBB", or "#AARRGGBB".
• android:gravity - This specifies how an object should position its
content, on both the X and Y axes. Possible values are top, bottom, left,
right, center, center_vertical, center_horizontal etc.
• android:orientation - This specifies the direction of arrangement and
you will use "horizontal" for a row, "vertical" for a column. The default is
horizontal.
Linear Layout Attributes
• android:layout_weight – This assigns importance on how much screen
a View can relatively occupy compare to others.
Linear Layout android:baselineAligned Example
Linear Layout android:baselineAligned Example
Linear Layout android:layout_weight Example
Linear Layout android:divider Example
Table Layout
• Android Table Layout going to be arranged groups of views into rows
and columns.
• You will use the <TableRow> element to build a row in the table. Each
row has zero or more cells; each cell can hold one View object.
Table Layout Example
Table Layout Example
Assignment
Q-1: Explain the following attributes of Table Layout with the help of an
Example.
1. android:collapseColumns
2. android:shrinkColumns
3. android:stretchColumns
android:shrinkColumns
• android:shrinkColumns="0"—The first column's width shrinks or
reduces by word-wrapping its content. android:shrinkColumns="*"—
The content of all columns is word-wrapped to shrink their widths.
android:stretchColumns
• The specified columns are stretched to take up any available space on
the row. Examples: android:stretchColumns="1"—The second column
(because the column numbers are 0-based) is stretched to take up
any available space in the row.
android:collapseColumns
• android:collapseColumns means it hide given column.
android:stretchColumns="*" TextView :- android:layout_column="2"
Meanning if tablerow first column layout parameter not start with 0
then empty view added into row.
Absolute Layout
• An Absolute Layout lets you specify exact locations (x/y coordinates) of its
children.
• Absolute layouts are less flexible and harder to maintain than other types
of layouts without absolute positioning.
Absolute Layout Example
Frame Layout
• You can add many views or View Groups to Frame layout just like the
other layouts.
• Views are stacked on the top of each other, for example if you are going to
add two buttons, one button is going to be add on the top of other button.
• This layout is very handy when you want to display one view at given time
of instant, and you want to ensure other views hidden from the user site.
• For example in e-books app you have one page visible at a time and other
invisible to user.
• The size of the frame layout is the size of largest view contained inside so
smaller views may be stretched.
Frame Layout Example
Frame Layout Example
Assignment
Q-2: Explain the following Layouts with the help of an Example.
1. Grid Layout
2. Constraint Layout
ConstraintLayout
• ConstraintLayout allows you to create large and complex layouts with
a flat view hierarchy (no nested view groups).
fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.keyframe_one)
constraintLayout = findViewById(R.id.constraint_layout) // member
variable
}
Grid layout
• A layout that places its children in a rectangular grid.
GridLayout.setColumnOrderPreserved(boolean).
Assignnment_02a
Create an application named “Student” in which design “Register
Activity” and “Login Activity” using Linear and Relative layout.
Note:
Student Name (Edit Text)
Student Email
Student Address
Student Phone
Register Button
Assignment_02b
Design a calculator layout as given in your mobile phone, you can use
grid layout.

More Related Content

Similar to W1_Lec01_Lec02_Layouts.pptx

Android ui layout
Android ui layoutAndroid ui layout
Android ui layoutKrazy Koder
 
Android android layouts
Android android layoutsAndroid android layouts
Android android layoutsperpetrotech
 
Day 4 android bootcamp
Day 4  android bootcampDay 4  android bootcamp
Day 4 android bootcamp
FatimaYousif11
 
Android Layout Tutorial | Android UI Design Explained | Edureka
Android Layout Tutorial | Android UI Design Explained | EdurekaAndroid Layout Tutorial | Android UI Design Explained | Edureka
Android Layout Tutorial | Android UI Design Explained | Edureka
Edureka!
 
#7 Android Layouts.pptx
#7 Android Layouts.pptx#7 Android Layouts.pptx
#7 Android Layouts.pptx
informationtechnolog69
 
Odoo views
Odoo viewsOdoo views
Odoo views
Celine George
 
Android Custom Views
Android Custom ViewsAndroid Custom Views
Android Custom Views
Babar Sanah
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Android Erası 2 - UI və layoutlar
Android Erası 2 - UI və layoutlarAndroid Erası 2 - UI və layoutlar
Android Erası 2 - UI və layoutlarOrkhan Ahmadov
 
the Modeling is a way of thinking about the
the Modeling is a way of thinking about thethe Modeling is a way of thinking about the
the Modeling is a way of thinking about the
saman zaker
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfaces
C.o. Nieto
 
Rajab Davudov - Android UI Design: Layouts
Rajab Davudov - Android UI Design: LayoutsRajab Davudov - Android UI Design: Layouts
Rajab Davudov - Android UI Design: Layouts
Rashad Aliyev
 
View groups containers
View groups containersView groups containers
View groups containersMani Selvaraj
 
Android Development - ConstraintLayout
Android Development - ConstraintLayoutAndroid Development - ConstraintLayout
Android Development - ConstraintLayout
Manuel Vicente Vivo
 
Lecture 02: Android Layouts.pptx
Lecture 02: Android Layouts.pptxLecture 02: Android Layouts.pptx
Lecture 02: Android Layouts.pptx
Yousef Alamir
 
Android Introduction , Activity, Intent & Layout.pdf
Android Introduction , Activity, Intent & Layout.pdfAndroid Introduction , Activity, Intent & Layout.pdf
Android Introduction , Activity, Intent & Layout.pdf
shamli5
 
MOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENTMOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENT
Muhammad Sajid
 
Welcome to android Apps
Welcome to android AppsWelcome to android Apps
Welcome to android Apps
Eng Chrispinus Onyancha
 
Session 3 android UI
Session 3   android UISession 3   android UI
Session 3 android UIAdham Enaya
 
Ch4 creating user interfaces
Ch4 creating user interfacesCh4 creating user interfaces
Ch4 creating user interfacesShih-Hsiang Lin
 

Similar to W1_Lec01_Lec02_Layouts.pptx (20)

Android ui layout
Android ui layoutAndroid ui layout
Android ui layout
 
Android android layouts
Android android layoutsAndroid android layouts
Android android layouts
 
Day 4 android bootcamp
Day 4  android bootcampDay 4  android bootcamp
Day 4 android bootcamp
 
Android Layout Tutorial | Android UI Design Explained | Edureka
Android Layout Tutorial | Android UI Design Explained | EdurekaAndroid Layout Tutorial | Android UI Design Explained | Edureka
Android Layout Tutorial | Android UI Design Explained | Edureka
 
#7 Android Layouts.pptx
#7 Android Layouts.pptx#7 Android Layouts.pptx
#7 Android Layouts.pptx
 
Odoo views
Odoo viewsOdoo views
Odoo views
 
Android Custom Views
Android Custom ViewsAndroid Custom Views
Android Custom Views
 
android layouts
android layoutsandroid layouts
android layouts
 
Android Erası 2 - UI və layoutlar
Android Erası 2 - UI və layoutlarAndroid Erası 2 - UI və layoutlar
Android Erası 2 - UI və layoutlar
 
the Modeling is a way of thinking about the
the Modeling is a way of thinking about thethe Modeling is a way of thinking about the
the Modeling is a way of thinking about the
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfaces
 
Rajab Davudov - Android UI Design: Layouts
Rajab Davudov - Android UI Design: LayoutsRajab Davudov - Android UI Design: Layouts
Rajab Davudov - Android UI Design: Layouts
 
View groups containers
View groups containersView groups containers
View groups containers
 
Android Development - ConstraintLayout
Android Development - ConstraintLayoutAndroid Development - ConstraintLayout
Android Development - ConstraintLayout
 
Lecture 02: Android Layouts.pptx
Lecture 02: Android Layouts.pptxLecture 02: Android Layouts.pptx
Lecture 02: Android Layouts.pptx
 
Android Introduction , Activity, Intent & Layout.pdf
Android Introduction , Activity, Intent & Layout.pdfAndroid Introduction , Activity, Intent & Layout.pdf
Android Introduction , Activity, Intent & Layout.pdf
 
MOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENTMOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENT
 
Welcome to android Apps
Welcome to android AppsWelcome to android Apps
Welcome to android Apps
 
Session 3 android UI
Session 3   android UISession 3   android UI
Session 3 android UI
 
Ch4 creating user interfaces
Ch4 creating user interfacesCh4 creating user interfaces
Ch4 creating user interfaces
 

More from ssuserc1e786

LEC 1.pptx
LEC 1.pptxLEC 1.pptx
LEC 1.pptx
ssuserc1e786
 
Bcsm-f20-405(Web-design).pptx
Bcsm-f20-405(Web-design).pptxBcsm-f20-405(Web-design).pptx
Bcsm-f20-405(Web-design).pptx
ssuserc1e786
 
Lecture W5 CN IP Subnetting P2.pptx
Lecture W5 CN IP Subnetting P2.pptxLecture W5 CN IP Subnetting P2.pptx
Lecture W5 CN IP Subnetting P2.pptx
ssuserc1e786
 
Lecture W2 CN Network Types, Layered approach.pptx
Lecture W2 CN Network Types, Layered approach.pptxLecture W2 CN Network Types, Layered approach.pptx
Lecture W2 CN Network Types, Layered approach.pptx
ssuserc1e786
 
Lecture W4 CN IP Addressing P1.pptx
Lecture W4 CN IP Addressing P1.pptxLecture W4 CN IP Addressing P1.pptx
Lecture W4 CN IP Addressing P1.pptx
ssuserc1e786
 
W2_Lec03_Lec_04_Activity.pptx
W2_Lec03_Lec_04_Activity.pptxW2_Lec03_Lec_04_Activity.pptx
W2_Lec03_Lec_04_Activity.pptx
ssuserc1e786
 
W1_Lec01_Lec02_Intro.pptx
W1_Lec01_Lec02_Intro.pptxW1_Lec01_Lec02_Intro.pptx
W1_Lec01_Lec02_Intro.pptx
ssuserc1e786
 

More from ssuserc1e786 (7)

LEC 1.pptx
LEC 1.pptxLEC 1.pptx
LEC 1.pptx
 
Bcsm-f20-405(Web-design).pptx
Bcsm-f20-405(Web-design).pptxBcsm-f20-405(Web-design).pptx
Bcsm-f20-405(Web-design).pptx
 
Lecture W5 CN IP Subnetting P2.pptx
Lecture W5 CN IP Subnetting P2.pptxLecture W5 CN IP Subnetting P2.pptx
Lecture W5 CN IP Subnetting P2.pptx
 
Lecture W2 CN Network Types, Layered approach.pptx
Lecture W2 CN Network Types, Layered approach.pptxLecture W2 CN Network Types, Layered approach.pptx
Lecture W2 CN Network Types, Layered approach.pptx
 
Lecture W4 CN IP Addressing P1.pptx
Lecture W4 CN IP Addressing P1.pptxLecture W4 CN IP Addressing P1.pptx
Lecture W4 CN IP Addressing P1.pptx
 
W2_Lec03_Lec_04_Activity.pptx
W2_Lec03_Lec_04_Activity.pptxW2_Lec03_Lec_04_Activity.pptx
W2_Lec03_Lec_04_Activity.pptx
 
W1_Lec01_Lec02_Intro.pptx
W1_Lec01_Lec02_Intro.pptxW1_Lec01_Lec02_Intro.pptx
W1_Lec01_Lec02_Intro.pptx
 

Recently uploaded

test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
GTProductions1
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
Gal Baras
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
JungkooksNonexistent
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
laozhuseo02
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
natyesu
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
laozhuseo02
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
VivekSinghShekhawat2
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Sanjeev Rampal
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
nirahealhty
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
Javier Lasa
 

Recently uploaded (20)

test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
 

W1_Lec01_Lec02_Layouts.pptx

  • 2. Outline View, View Groups, Layouts, Layout Types, Linear Layout, Linear Layout Attributes, Linear Layout Example, Table Layout, Absolute Layout, Frame Layout
  • 3. What is View in Android App Development? •The basic building block for user interface is a View. •View is created from the View class and occupies a rectangular area on the screen. •View is responsible for drawing and event handling. •View is the base class for widgets, which are used to create interactive UI components like buttons, text fields, etc.
  • 4. View Groups in Android App Development? • The View Group is a subclass of View and provides invisible container that hold other Views or other View Groups and define their layout properties.
  • 5. What is Layout in Android App Development • Layouts are subclasses of View Group class, and a typical layout defines the visual structure for an Android user interface. • The layout defines the visual structure of your application. • Android Studio uses this structure to display the view elements on the screen. • Layouts are also called view containers. • A layout may contain any type of views such as buttons, labels, textboxes, and so on.
  • 6. Android Studio Layout Types • Linear Layout • Relative Layout • Table Layout • Absolute Layout • Frame Layout • Grid Layout • Constraint Layout
  • 7. Linear Layout • Android Linear Layout is a View Group that aligns all its children in either vertically or horizontally.
  • 8. Linear Layout Attributes • android:id - This is the ID which uniquely identifies the layout. • android:baselineAligned - This must be a Boolean value, either "true" or "false" and prevents the layout from aligning its children's baselines. • android:divider - This is drawable to use as a vertical divider between buttons. You use a color value, in the form of "#RGB", "#ARGB", "#RRGGBB", or "#AARRGGBB". • android:gravity - This specifies how an object should position its content, on both the X and Y axes. Possible values are top, bottom, left, right, center, center_vertical, center_horizontal etc. • android:orientation - This specifies the direction of arrangement and you will use "horizontal" for a row, "vertical" for a column. The default is horizontal.
  • 9. Linear Layout Attributes • android:layout_weight – This assigns importance on how much screen a View can relatively occupy compare to others.
  • 14. Table Layout • Android Table Layout going to be arranged groups of views into rows and columns. • You will use the <TableRow> element to build a row in the table. Each row has zero or more cells; each cell can hold one View object.
  • 17. Assignment Q-1: Explain the following attributes of Table Layout with the help of an Example. 1. android:collapseColumns 2. android:shrinkColumns 3. android:stretchColumns
  • 18. android:shrinkColumns • android:shrinkColumns="0"—The first column's width shrinks or reduces by word-wrapping its content. android:shrinkColumns="*"— The content of all columns is word-wrapped to shrink their widths.
  • 19. android:stretchColumns • The specified columns are stretched to take up any available space on the row. Examples: android:stretchColumns="1"—The second column (because the column numbers are 0-based) is stretched to take up any available space in the row.
  • 20. android:collapseColumns • android:collapseColumns means it hide given column. android:stretchColumns="*" TextView :- android:layout_column="2" Meanning if tablerow first column layout parameter not start with 0 then empty view added into row.
  • 21. Absolute Layout • An Absolute Layout lets you specify exact locations (x/y coordinates) of its children. • Absolute layouts are less flexible and harder to maintain than other types of layouts without absolute positioning.
  • 23. Frame Layout • You can add many views or View Groups to Frame layout just like the other layouts. • Views are stacked on the top of each other, for example if you are going to add two buttons, one button is going to be add on the top of other button. • This layout is very handy when you want to display one view at given time of instant, and you want to ensure other views hidden from the user site. • For example in e-books app you have one page visible at a time and other invisible to user. • The size of the frame layout is the size of largest view contained inside so smaller views may be stretched.
  • 26. Assignment Q-2: Explain the following Layouts with the help of an Example. 1. Grid Layout 2. Constraint Layout
  • 27. ConstraintLayout • ConstraintLayout allows you to create large and complex layouts with a flat view hierarchy (no nested view groups). fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.keyframe_one) constraintLayout = findViewById(R.id.constraint_layout) // member variable }
  • 28. Grid layout • A layout that places its children in a rectangular grid. GridLayout.setColumnOrderPreserved(boolean).
  • 29. Assignnment_02a Create an application named “Student” in which design “Register Activity” and “Login Activity” using Linear and Relative layout. Note: Student Name (Edit Text) Student Email Student Address Student Phone Register Button
  • 30. Assignment_02b Design a calculator layout as given in your mobile phone, you can use grid layout.