SlideShare a Scribd company logo
Mobile Programming - 3 Rows, Column and Basic Sizing
2
Compose layout basics
Jetpack Compose makes it much easier to design and
build your app's UI. Compose transforms state into UI
elements, via:
1. Composition of elements
2. Layout of elements
3. Drawing of elements
3
Jetpack Compose Layout Structure
4
The Jetpack Compose implementation of the layout system has two
main goals:
• High performance
• Ability to easily write custom layouts
Composable functions are the basic building block
of Compose. A composable function is a function
emitting Unit that describes some part of your UI.
The function takes some input and generates
what's shown on the screen.
Basics of Composable functions
5
A Composable function might emit several UI
elements. However, if you don't provide guidance
on how they should be arranged, Compose might
arrange the elements in a way you don't like.
Basics of Composable functions
(Cont.)
6
Compose layout basics
A Composable function might emit several UI elements.
However, if you don't provide guidance on how they
should be arranged, Compose might arrange the elements
in a way you don't like. For example, this code generates
two text elements:
7
Compose layout basics
(Cont.)
Without guidance on how you want them arranged,
Compose stacks the text elements on top of each other,
making them unreadable:
Compose provides a collection of ready-to-use layouts to
help you arrange your UI elements, and makes it easy to
define your own, more-specialized layouts.
8
Column Layout
9
In many cases, you can just use Compose's standard layout elements.
Use Column to place items vertically on the screen.
Here is the result of using column on two text
elements:
You can see the difference from the previous one,
where the two text elements are placed vertically
apart
Column Layout (Cont.)
10
Row Layout
Similarly, use Row to place items horizontally on the
screen. Both Column and Row support configuring the
alignment of the elements they contain.
11
Row Layout (Cont.)
Here is the result of using row on two text elements:
You can see the difference from the previous one, where
the two text elements are placed horizontally apart
12
Box Layout
13
Use Box to put elements on top of another. Box also supports
configuring specific alignment of the elements it contains.
Here is the result of using box on two elements:
You can see the difference from the previous one,
where the two elements are placed in a stack
Box Layout (Cont.)
14
Combination of Column, Row, and Box
15
Often these building blocks are all you need. You can write your own
composable function to combine these layouts into a more elaborate
layout that suits your app.
Children Position
To set children's position within a Row, set the
horizontalArrangement and verticalAlignment
arguments. For a Column, set the verticalArrangement
and horizontalAlignment arguments:
16
Children Position (Cont.)
Here is the result of using children’s position on two
elements:
You can see the difference from the previous one, where
the two elements are placed align right
17
Mobile Programming - 3 Rows, Column and Basic Sizing

More Related Content

PDF
Mobile Programming - 5 Stylling Text and State
PDF
Mobile Programming - 6 Textfields, Button, Showing Snackbars and Lists
PDF
Mobile Programming - 7 Side Effects, Effect Handlers, and Simple Animations
PDF
Context at design
PDF
Auto Layout on Xcode 5
PPTX
Beautiful UI in react native By - nativebase.io
PDF
Diving deep in compose.pdf
PPTX
Compose camp 2.pptx
Mobile Programming - 5 Stylling Text and State
Mobile Programming - 6 Textfields, Button, Showing Snackbars and Lists
Mobile Programming - 7 Side Effects, Effect Handlers, and Simple Animations
Context at design
Auto Layout on Xcode 5
Beautiful UI in react native By - nativebase.io
Diving deep in compose.pdf
Compose camp 2.pptx

Similar to Mobile Programming - 3 Rows, Column and Basic Sizing (20)

PPTX
Kotlin Jetpack Tutorial
PPTX
Day 2.pptx
PPTX
Compose Camp Day 2.pptx
PPTX
W1_Lec01_Lec02_Layouts.pptx
PPTX
Day 4 android bootcamp
PDF
Android Jetpack Compose - Turkey 2021
PPTX
WMP_MP02_revd_03(10092023).pptx
DOCX
Android practice of layout in application-chapter6
PPTX
Lecture_On_AndroidApp_UserInterface.pptx
PPTX
WMP_MP02_revd(10092023).pptx
PDF
Android Layout Tutorial | Android UI Design Explained | Edureka
PDF
COMPOSE CAMP SESSION 4.pdf
PDF
Mobile Application Development -Lecture 07 & 08.pdf
DOCX
How to create ui using droid draw
PPTX
Jetpack Compose - Android’s modern toolkit for building native UI
PPTX
Android jetpack compose | Declarative UI
PPT
android layouts
PDF
Compose Camp Day 3 PPT.pptx.pdf
PPTX
01.2 Layouts and resources for the UI.pptx
PPTX
Kotlin Jetpack Tutorial
Day 2.pptx
Compose Camp Day 2.pptx
W1_Lec01_Lec02_Layouts.pptx
Day 4 android bootcamp
Android Jetpack Compose - Turkey 2021
WMP_MP02_revd_03(10092023).pptx
Android practice of layout in application-chapter6
Lecture_On_AndroidApp_UserInterface.pptx
WMP_MP02_revd(10092023).pptx
Android Layout Tutorial | Android UI Design Explained | Edureka
COMPOSE CAMP SESSION 4.pdf
Mobile Application Development -Lecture 07 & 08.pdf
How to create ui using droid draw
Jetpack Compose - Android’s modern toolkit for building native UI
Android jetpack compose | Declarative UI
android layouts
Compose Camp Day 3 PPT.pptx.pdf
01.2 Layouts and resources for the UI.pptx
Ad

More from AndiNurkholis1 (20)

PDF
Technopreneurship - 9 Analisis Biaya dan Keuangan
PDF
Pengantar Bisnis - 14 Manajemen Keuangan
PDF
Pengantar Bisnis - 13 Manajemen Operasi
PDF
Pengantar Bisnis - 12 Kebijakan Harga
PDF
Pengantar Bisnis - 11 Kebijakan Distribusi
PDF
Technopreneurship - 8 Manajemen Sumber Daya Manusia
PDF
Pengantar Bisnis - 10 Kebijakan Produk
PDF
Technopreneurship - 7 Manajemen Pemasaran dan Operasional Bisnis
PDF
Pengantar Bisnis - 9 Manajemen Pemasaran
PDF
Technopreneurship - 6 Business Plan
PDF
Pengantar Bisnis - 8 Kepemimpinan
PDF
Technopreneurship - 5 Model Bisnis
PDF
Technopreneurship - 4 Studi Kelayakan Usaha
PDF
Pengantar Bisnis - 7 Motivasi Kerja
PDF
Pengantar Bisnis - 6 Manajemen Sumber Daya Manusia
PDF
Pengantar Bisnis - 5 Pengelolaan & Pengorganisasian Bisnis
PDF
Technopreneurship - 3 Ide dan Prinsip Bisnis
PDF
Pengantar Bisnis - 4 Bentuk Organisasi Bisnis
PDF
Technopreneurship - 2 Pengantar Technopreneurship
PDF
Pengantar Bisnis - 3 Globalisasi Ekonomi & Bisnis Internasional
Technopreneurship - 9 Analisis Biaya dan Keuangan
Pengantar Bisnis - 14 Manajemen Keuangan
Pengantar Bisnis - 13 Manajemen Operasi
Pengantar Bisnis - 12 Kebijakan Harga
Pengantar Bisnis - 11 Kebijakan Distribusi
Technopreneurship - 8 Manajemen Sumber Daya Manusia
Pengantar Bisnis - 10 Kebijakan Produk
Technopreneurship - 7 Manajemen Pemasaran dan Operasional Bisnis
Pengantar Bisnis - 9 Manajemen Pemasaran
Technopreneurship - 6 Business Plan
Pengantar Bisnis - 8 Kepemimpinan
Technopreneurship - 5 Model Bisnis
Technopreneurship - 4 Studi Kelayakan Usaha
Pengantar Bisnis - 7 Motivasi Kerja
Pengantar Bisnis - 6 Manajemen Sumber Daya Manusia
Pengantar Bisnis - 5 Pengelolaan & Pengorganisasian Bisnis
Technopreneurship - 3 Ide dan Prinsip Bisnis
Pengantar Bisnis - 4 Bentuk Organisasi Bisnis
Technopreneurship - 2 Pengantar Technopreneurship
Pengantar Bisnis - 3 Globalisasi Ekonomi & Bisnis Internasional
Ad

Recently uploaded (20)

PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
System and Network Administration Chapter 2
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Digital Strategies for Manufacturing Companies
PPTX
history of c programming in notes for students .pptx
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Nekopoi APK 2025 free lastest update
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
How Creative Agencies Leverage Project Management Software.pdf
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
System and Network Administration Chapter 2
CHAPTER 2 - PM Management and IT Context
How to Migrate SBCGlobal Email to Yahoo Easily
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Digital Strategies for Manufacturing Companies
history of c programming in notes for students .pptx
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Design an Analysis of Algorithms II-SECS-1021-03
Nekopoi APK 2025 free lastest update
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Softaken Excel to vCard Converter Software.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Design an Analysis of Algorithms I-SECS-1021-03
Wondershare Filmora 15 Crack With Activation Key [2025
How Creative Agencies Leverage Project Management Software.pdf

Mobile Programming - 3 Rows, Column and Basic Sizing

  • 2. 2
  • 3. Compose layout basics Jetpack Compose makes it much easier to design and build your app's UI. Compose transforms state into UI elements, via: 1. Composition of elements 2. Layout of elements 3. Drawing of elements 3
  • 4. Jetpack Compose Layout Structure 4 The Jetpack Compose implementation of the layout system has two main goals: • High performance • Ability to easily write custom layouts
  • 5. Composable functions are the basic building block of Compose. A composable function is a function emitting Unit that describes some part of your UI. The function takes some input and generates what's shown on the screen. Basics of Composable functions 5
  • 6. A Composable function might emit several UI elements. However, if you don't provide guidance on how they should be arranged, Compose might arrange the elements in a way you don't like. Basics of Composable functions (Cont.) 6
  • 7. Compose layout basics A Composable function might emit several UI elements. However, if you don't provide guidance on how they should be arranged, Compose might arrange the elements in a way you don't like. For example, this code generates two text elements: 7
  • 8. Compose layout basics (Cont.) Without guidance on how you want them arranged, Compose stacks the text elements on top of each other, making them unreadable: Compose provides a collection of ready-to-use layouts to help you arrange your UI elements, and makes it easy to define your own, more-specialized layouts. 8
  • 9. Column Layout 9 In many cases, you can just use Compose's standard layout elements. Use Column to place items vertically on the screen.
  • 10. Here is the result of using column on two text elements: You can see the difference from the previous one, where the two text elements are placed vertically apart Column Layout (Cont.) 10
  • 11. Row Layout Similarly, use Row to place items horizontally on the screen. Both Column and Row support configuring the alignment of the elements they contain. 11
  • 12. Row Layout (Cont.) Here is the result of using row on two text elements: You can see the difference from the previous one, where the two text elements are placed horizontally apart 12
  • 13. Box Layout 13 Use Box to put elements on top of another. Box also supports configuring specific alignment of the elements it contains.
  • 14. Here is the result of using box on two elements: You can see the difference from the previous one, where the two elements are placed in a stack Box Layout (Cont.) 14
  • 15. Combination of Column, Row, and Box 15 Often these building blocks are all you need. You can write your own composable function to combine these layouts into a more elaborate layout that suits your app.
  • 16. Children Position To set children's position within a Row, set the horizontalArrangement and verticalAlignment arguments. For a Column, set the verticalArrangement and horizontalAlignment arguments: 16
  • 17. Children Position (Cont.) Here is the result of using children’s position on two elements: You can see the difference from the previous one, where the two elements are placed align right 17