SlideShare a Scribd company logo
MOBILE APPLICATION
DEVELOPMENT
LECTURE – 4b
By: AbuBakar Ubaid
LAYOUTS
By: AbuBakar Ubaid
LINEARLAYOUT
• Good for smaller devices (like phones over Tablets) or when
simple interface makes sense
• Layout in column (for Vertical) or row (for Horizontal) one
after another child View objects
• Some Examples
3
LINEARLAYOUT
Good:
• Simple
• Know exactly how it will look on every device
Bad:
• Well for many interfaces too simple….
BUT  see next slide
• BUT, REMEMBER you can have a ViewGroup (another Layout) inside
as a member of the LinearLayout to make a more COMPLEX interface
• ALSO can make more coplex
4
LinearLayout Very SIMPLE Example
• arranges by single column (vertical orientation)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Text View
android:layout_width=“fill_parent”
android:layout_height=“wrap_content”
android:text=“@string/hello”/>
</LinearLayout> VERY simple example – LinearLayout with one
child View object, a TextView saying Hello….
LinearLayout Example 2
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent“
android:orientation="vertical" >
<Button android:id="@+id/btn_webbrowser"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Web Browser“
android:onClick="onClickWebBrowser" />
<Button android:id="@+id/btn_makecalls"
android:layout_width="fill_parent"
android:layout_height="wrap_content“
android:text="Make Calls"
android:onClick="onClickMakeCalls" />
<Button android:id="@+id/btn_showMap"
android:layout_width="fill_parent"
android:layout_height="wrap_content“
android:text="Show Map"
android:onClick="onClickShowMap" />
<Button android:id="@+id/btn_launchMyBrowser"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Launch My Browser"
android:onClick="onClickLaunchMyBrowser" />
</LinearLayout>
LinearLayout with 4 child View objects,
all are buttons
LinearLayout attributes
• You can set either in XML or with set*()
methods.
Xml
android:orientation=“vertical”
code (ll is LinearLayout instance)
ll.setOrientation(VERTICAL);
Each View or ViewGroup can
have its own set of
attributes…but, some are
very common
Attribute Description
layout_width specifies width of View or
ViewGroup
layout_height specifies height
layout_marginTop extra space on top
layout_marginBottom extra space on bottom side
layout_marginLeft extra space on left side
layout_marginRight extra space on right side
layout_gravity how child views are positioned
layout_weight how much extra space in layout
should be allocated to View (only
when in LinearLayout or TableView)
layout_x x-coordinate
layout_y y-coordinate
Another Option to get Complexity What
about Other Layouts
• RelativeLayout is good ---and can make your
design EASIER
• Note: there is more than one way to use
Layouts to create a look in an interface that is
the same ---so, this in part is an art and in
part how you think of things ---but, sometimes
as we will see later some Layouts can be
faster (especially when compared to nested
layouts)
RelativeLayout
GOOD:
• Can give more complex interfaces
• Know what will look like on different sized devices
• Position relative to another position
CAUTION This is meant to be flat –meaning you don’t
want/need to nest RelativeLayouts in each other –
sometimes may impact speed in rendering and some
have reported problems.
RelativeLayout – how it works
Parameters in XML (or can map to method calls in Java
RelativeLayout class)
• Position relative to Parent
android:layout_alignParentTop,
android:layout_alignParentBottom,
android:layout_alignParentLeft, android:layout_alignParentRight
VALUE = ‘true’ ---If "true", moves to that edge of Parent
android:layout_centerVertical
VALUE= “true” -- If "true", centers this child vertically within its
parent.
• Position relative to another widget
android:layout_below, android:layout_above,
android:layout_toLeftOf, android:layout_toRightOf
VALUE=“resource ID of other widget” -- Positions the top edge
of this view below/aboveof the view specified with a resource ID.
OR Positions the left edge of this view to the left/right of the
view specified with a resource ID.
RelativeLayout – how it works
Example
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp" >
<EditText
android:id="@+id/name"
android:layout_width="match_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>
Says we have RelativeLayout
that width and height match parent
(which is the entire app screen)
1st View object in RelativeLayout
will be at the top and is the EditText
2nd View object here is specified to be
below the 1st object EditText (id = name)
& aligned to left of parent(app)
& Left of the Button with id=times (see below)
3rd View object here is specified to be
below the 1st object EditText (id = name)
& aligned to left of parent(app)
4th View object here is specified to be
below the 2nd object Spinner (id = times)
& aligned to right of parent(app)
More on RelativeLayout parameters
• Center
Top
Bottom
of
Parent
There are many other Layouts
• Look them up on Android Developer site
• They include:TableLayout (think a table),
GridLayout, FrameLayout, and MORE!!
TableLayout
Read book and look at
developer website to learn
about others like TableLayout
TableLayout Example
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="@string/table_layout_4_open"
android:padding="3dip" />
<TextView
android:text="@string/table_layout_4_open_shortcut"
android:gravity="right"
android:padding="3dip" />
</TableRow>
<TableRow>
<TextView
android:text="@string/table_layout_4_save"
android:padding="3dip" />
<TextView
android:text="@string/table_layout_4_save_shortcut"
android:gravity="right"
android:padding="3dip" />
</TableRow>
</TableLayout>
This Table has 2 Rows
TableLayout example 2
• Here use gravity to move the 2nd item in row to
the right
ONLY partial XML code
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:layout_column="1"
android:text="Open..."
android:padding="3dip" />
<TextView
android:text="Ctrl-O"
android:gravity="right"
android:padding="3dip" />
</TableRow>
<TableRow> NOW CONTINUE ON FOR 2nd row
THANK YOU 
LECTURE – 4b “Layouts”
By: AbuBakar Ubaid

More Related Content

Similar to MOBILE APPLICATION DEVELOPMENT

android layouts
android layoutsandroid layouts
android layouts
Deepa Rani
 
Layouts in android
Layouts in androidLayouts in android
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and Container
Oum Saokosal
 
Application Development - Overview on Android OS
Application Development - Overview on Android OSApplication Development - Overview on Android OS
Application Development - Overview on Android OS
Pankaj Maheshwari
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
Brenda Cook
 
Android Layout.pptx
Android Layout.pptxAndroid Layout.pptx
Android Layout.pptx
vishal choudhary
 
Designing and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tabletsDesigning and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tablets
Teddy Koornia
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
Eliran Eliassy
 
User experience and interactions design
User experience and interactions design User experience and interactions design
User experience and interactions design
Rakesh Jha
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
Chiew Carol
 
06 UI Layout
06 UI Layout06 UI Layout
06 UI Layout
Sokngim Sa
 
Android_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_EngineeringAndroid_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_Engineering
ShivanshSeth6
 
Hello Android
Hello AndroidHello Android
Hello Android
Trong Dinh
 
W1_Lec01_Lec02_Layouts.pptx
W1_Lec01_Lec02_Layouts.pptxW1_Lec01_Lec02_Layouts.pptx
W1_Lec01_Lec02_Layouts.pptx
ssuserc1e786
 
From Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyFrom Back to Front: Rails To React Family
From Back to Front: Rails To React Family
Khor SoonHin
 
mobile application development -unit-3-
mobile application development  -unit-3-mobile application development  -unit-3-
mobile application development -unit-3-
TejamFandat
 
WMP_MP02_revd(10092023).pptx
WMP_MP02_revd(10092023).pptxWMP_MP02_revd(10092023).pptx
WMP_MP02_revd(10092023).pptx
fahmi324663
 
Android | Busy Java Developers Guide to Android: UI | Ted Neward
Android | Busy Java Developers Guide to Android: UI | Ted NewardAndroid | Busy Java Developers Guide to Android: UI | Ted Neward
Android | Busy Java Developers Guide to Android: UI | Ted Neward
JAX London
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in android
InnovationM
 
Session #7 rich and responsive layouts
Session #7  rich and responsive layoutsSession #7  rich and responsive layouts
Session #7 rich and responsive layouts
Vitali Pekelis
 

Similar to MOBILE APPLICATION DEVELOPMENT (20)

android layouts
android layoutsandroid layouts
android layouts
 
Layouts in android
Layouts in androidLayouts in android
Layouts in android
 
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and Container
 
Application Development - Overview on Android OS
Application Development - Overview on Android OSApplication Development - Overview on Android OS
Application Development - Overview on Android OS
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
Android Layout.pptx
Android Layout.pptxAndroid Layout.pptx
Android Layout.pptx
 
Designing and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tabletsDesigning and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tablets
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
User experience and interactions design
User experience and interactions design User experience and interactions design
User experience and interactions design
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
06 UI Layout
06 UI Layout06 UI Layout
06 UI Layout
 
Android_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_EngineeringAndroid_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_Engineering
 
Hello Android
Hello AndroidHello Android
Hello Android
 
W1_Lec01_Lec02_Layouts.pptx
W1_Lec01_Lec02_Layouts.pptxW1_Lec01_Lec02_Layouts.pptx
W1_Lec01_Lec02_Layouts.pptx
 
From Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyFrom Back to Front: Rails To React Family
From Back to Front: Rails To React Family
 
mobile application development -unit-3-
mobile application development  -unit-3-mobile application development  -unit-3-
mobile application development -unit-3-
 
WMP_MP02_revd(10092023).pptx
WMP_MP02_revd(10092023).pptxWMP_MP02_revd(10092023).pptx
WMP_MP02_revd(10092023).pptx
 
Android | Busy Java Developers Guide to Android: UI | Ted Neward
Android | Busy Java Developers Guide to Android: UI | Ted NewardAndroid | Busy Java Developers Guide to Android: UI | Ted Neward
Android | Busy Java Developers Guide to Android: UI | Ted Neward
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in android
 
Session #7 rich and responsive layouts
Session #7  rich and responsive layoutsSession #7  rich and responsive layouts
Session #7 rich and responsive layouts
 

More from Muhammad Sajid

eCommerce App Lecture
eCommerce App LectureeCommerce App Lecture
eCommerce App Lecture
Muhammad Sajid
 
Characteristics of enterprise application software
Characteristics of enterprise application softwareCharacteristics of enterprise application software
Characteristics of enterprise application software
Muhammad Sajid
 
The Checkout and Order Process
The Checkout and Order ProcessThe Checkout and Order Process
The Checkout and Order Process
Muhammad Sajid
 
The Shopping Basket
The Shopping BasketThe Shopping Basket
The Shopping Basket
Muhammad Sajid
 
Enhancing the User Experience
Enhancing the User ExperienceEnhancing the User Experience
Enhancing the User Experience
Muhammad Sajid
 
Products and Categories
Products and CategoriesProducts and Categories
Products and Categories
Muhammad Sajid
 
E-Commerce Applications Development
E-Commerce Applications Development E-Commerce Applications Development
E-Commerce Applications Development
Muhammad Sajid
 
E-Commerce Applications Development
E-Commerce Applications Development E-Commerce Applications Development
E-Commerce Applications Development
Muhammad Sajid
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
Muhammad Sajid
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
Muhammad Sajid
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
Muhammad Sajid
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application Development
Muhammad Sajid
 
MOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENTMOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENT
Muhammad Sajid
 
MOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENTMOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENT
Muhammad Sajid
 
MOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENTMOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENT
Muhammad Sajid
 
Your first Android App
Your first Android AppYour first Android App
Your first Android App
Muhammad Sajid
 
Group Aided Decision making revised
Group Aided Decision making revisedGroup Aided Decision making revised
Group Aided Decision making revised
Muhammad Sajid
 
Pakistan Studies notes
Pakistan Studies notesPakistan Studies notes
Pakistan Studies notes
Muhammad Sajid
 
Components of Computing Game
Components of Computing GameComponents of Computing Game
Components of Computing Game
Muhammad Sajid
 
Design Elements of Computing Game
Design Elements  of Computing GameDesign Elements  of Computing Game
Design Elements of Computing Game
Muhammad Sajid
 

More from Muhammad Sajid (20)

eCommerce App Lecture
eCommerce App LectureeCommerce App Lecture
eCommerce App Lecture
 
Characteristics of enterprise application software
Characteristics of enterprise application softwareCharacteristics of enterprise application software
Characteristics of enterprise application software
 
The Checkout and Order Process
The Checkout and Order ProcessThe Checkout and Order Process
The Checkout and Order Process
 
The Shopping Basket
The Shopping BasketThe Shopping Basket
The Shopping Basket
 
Enhancing the User Experience
Enhancing the User ExperienceEnhancing the User Experience
Enhancing the User Experience
 
Products and Categories
Products and CategoriesProducts and Categories
Products and Categories
 
E-Commerce Applications Development
E-Commerce Applications Development E-Commerce Applications Development
E-Commerce Applications Development
 
E-Commerce Applications Development
E-Commerce Applications Development E-Commerce Applications Development
E-Commerce Applications Development
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application Development
 
MOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENTMOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENT
 
MOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENTMOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENT
 
MOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENTMOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENT
 
Your first Android App
Your first Android AppYour first Android App
Your first Android App
 
Group Aided Decision making revised
Group Aided Decision making revisedGroup Aided Decision making revised
Group Aided Decision making revised
 
Pakistan Studies notes
Pakistan Studies notesPakistan Studies notes
Pakistan Studies notes
 
Components of Computing Game
Components of Computing GameComponents of Computing Game
Components of Computing Game
 
Design Elements of Computing Game
Design Elements  of Computing GameDesign Elements  of Computing Game
Design Elements of Computing Game
 

Recently uploaded

Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
Amin Marwan
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 

Recently uploaded (20)

Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 

MOBILE APPLICATION DEVELOPMENT

  • 3. LINEARLAYOUT • Good for smaller devices (like phones over Tablets) or when simple interface makes sense • Layout in column (for Vertical) or row (for Horizontal) one after another child View objects • Some Examples 3
  • 4. LINEARLAYOUT Good: • Simple • Know exactly how it will look on every device Bad: • Well for many interfaces too simple…. BUT  see next slide • BUT, REMEMBER you can have a ViewGroup (another Layout) inside as a member of the LinearLayout to make a more COMPLEX interface • ALSO can make more coplex 4
  • 5. LinearLayout Very SIMPLE Example • arranges by single column (vertical orientation) <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <Text View android:layout_width=“fill_parent” android:layout_height=“wrap_content” android:text=“@string/hello”/> </LinearLayout> VERY simple example – LinearLayout with one child View object, a TextView saying Hello….
  • 6. LinearLayout Example 2 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent“ android:orientation="vertical" > <Button android:id="@+id/btn_webbrowser" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Web Browser“ android:onClick="onClickWebBrowser" /> <Button android:id="@+id/btn_makecalls" android:layout_width="fill_parent" android:layout_height="wrap_content“ android:text="Make Calls" android:onClick="onClickMakeCalls" /> <Button android:id="@+id/btn_showMap" android:layout_width="fill_parent" android:layout_height="wrap_content“ android:text="Show Map" android:onClick="onClickShowMap" /> <Button android:id="@+id/btn_launchMyBrowser" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Launch My Browser" android:onClick="onClickLaunchMyBrowser" /> </LinearLayout> LinearLayout with 4 child View objects, all are buttons
  • 7. LinearLayout attributes • You can set either in XML or with set*() methods. Xml android:orientation=“vertical” code (ll is LinearLayout instance) ll.setOrientation(VERTICAL);
  • 8. Each View or ViewGroup can have its own set of attributes…but, some are very common Attribute Description layout_width specifies width of View or ViewGroup layout_height specifies height layout_marginTop extra space on top layout_marginBottom extra space on bottom side layout_marginLeft extra space on left side layout_marginRight extra space on right side layout_gravity how child views are positioned layout_weight how much extra space in layout should be allocated to View (only when in LinearLayout or TableView) layout_x x-coordinate layout_y y-coordinate
  • 9. Another Option to get Complexity What about Other Layouts • RelativeLayout is good ---and can make your design EASIER • Note: there is more than one way to use Layouts to create a look in an interface that is the same ---so, this in part is an art and in part how you think of things ---but, sometimes as we will see later some Layouts can be faster (especially when compared to nested layouts)
  • 10. RelativeLayout GOOD: • Can give more complex interfaces • Know what will look like on different sized devices • Position relative to another position CAUTION This is meant to be flat –meaning you don’t want/need to nest RelativeLayouts in each other – sometimes may impact speed in rendering and some have reported problems.
  • 11. RelativeLayout – how it works Parameters in XML (or can map to method calls in Java RelativeLayout class) • Position relative to Parent android:layout_alignParentTop, android:layout_alignParentBottom, android:layout_alignParentLeft, android:layout_alignParentRight VALUE = ‘true’ ---If "true", moves to that edge of Parent android:layout_centerVertical VALUE= “true” -- If "true", centers this child vertically within its parent. • Position relative to another widget android:layout_below, android:layout_above, android:layout_toLeftOf, android:layout_toRightOf VALUE=“resource ID of other widget” -- Positions the top edge of this view below/aboveof the view specified with a resource ID. OR Positions the left edge of this view to the left/right of the view specified with a resource ID.
  • 12. RelativeLayout – how it works Example <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="16dp" android:paddingRight="16dp" > <EditText android:id="@+id/name" android:layout_width="match_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> Says we have RelativeLayout that width and height match parent (which is the entire app screen) 1st View object in RelativeLayout will be at the top and is the EditText 2nd View object here is specified to be below the 1st object EditText (id = name) & aligned to left of parent(app) & Left of the Button with id=times (see below) 3rd View object here is specified to be below the 1st object EditText (id = name) & aligned to left of parent(app) 4th View object here is specified to be below the 2nd object Spinner (id = times) & aligned to right of parent(app)
  • 13. More on RelativeLayout parameters • Center Top Bottom of Parent
  • 14. There are many other Layouts • Look them up on Android Developer site • They include:TableLayout (think a table), GridLayout, FrameLayout, and MORE!! TableLayout Read book and look at developer website to learn about others like TableLayout
  • 15. TableLayout Example <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:stretchColumns="1"> <TableRow> <TextView android:text="@string/table_layout_4_open" android:padding="3dip" /> <TextView android:text="@string/table_layout_4_open_shortcut" android:gravity="right" android:padding="3dip" /> </TableRow> <TableRow> <TextView android:text="@string/table_layout_4_save" android:padding="3dip" /> <TextView android:text="@string/table_layout_4_save_shortcut" android:gravity="right" android:padding="3dip" /> </TableRow> </TableLayout> This Table has 2 Rows
  • 16. TableLayout example 2 • Here use gravity to move the 2nd item in row to the right ONLY partial XML code <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:stretchColumns="1"> <TableRow> <TextView android:layout_column="1" android:text="Open..." android:padding="3dip" /> <TextView android:text="Ctrl-O" android:gravity="right" android:padding="3dip" /> </TableRow> <TableRow> NOW CONTINUE ON FOR 2nd row
  • 17. THANK YOU  LECTURE – 4b “Layouts” By: AbuBakar Ubaid