0% found this document useful (0 votes)
3 views

lecture 6

The document provides an overview of different layout types in Android development, including Linear Layout, Relative Layout, Frame Layout, and Constraint Layout. It defines layouts as structures that arrange UI elements and details the attributes and best use cases for each layout type. The content is aimed at educating students in a Mobile Application course about the importance and functionality of layouts in app design.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

lecture 6

The document provides an overview of different layout types in Android development, including Linear Layout, Relative Layout, Frame Layout, and Constraint Layout. It defines layouts as structures that arrange UI elements and details the attributes and best use cases for each layout type. The content is aimed at educating students in a Mobile Application course about the importance and functionality of layouts in app design.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Faculty Of Engineering and Technology

Department of Computer Science


Course: Mobile Application In java

(Lecture-4)

Sayed Mortaza Kazemi


Department of Computer Science
Email: [email protected]
Mobile: +93(0) 795474969
Content

• Layouts
• Linear Layout
• Relative Layout
• Frame Layout
• Constraint Layout

2
Definition of Layouts
• Layouts in Android refer to the structure that defines how UI elements,
such as buttons, text fields, images, and other views, are arranged and
displayed on the screen.
• Layouts are containers that hold views (UI components) and define the
spatial relationship between them.
• The layout dictates the position, size, and appearance of its child views on
different devices and screen sizes.

3
RelativeLayout
• Definition: Places child views relative to each other or the parent
container
• Common attributes:
• layout_alignParentTop =“true”: Aligns the top edge of the view to the top
edge of the parent (RelativeLayout).
• android:layout_alignParentBottom=“true”: Aligns the bottom edge of the
view to the bottom edge of the parent.
• android:layout_alignParentStart=“true”: Aligns the start edge (left for LTR,
right for RTL) of the view to the start edge of the parent.

4
• layout_alignParentEnd=“true”: Aligns the end edge (right for LTR, left for
RTL) of the view to the end edge of the parent.
• layout_centerInParent =“true”: Centers the view both vertically and
horizontally within the parent layout.
• layout_centerHorizontal =“true”: Centers the view horizontally within the
parent layout.
• layout_centerVertical =“true”: Centers the view vertically within the
parent layout.
• layout_above ="@id/textView1" : Positions the view directly above
another view.

5
• layout_below ="@id/textView1" : Positions the view directly below
another view.

6
FrameLayout Overview
• Definition: Simplest layout, designed to display one child view at a time
• Stacks multiple views on top of each other
• Common attributes:
• layout_gravity
• layout_width,
• layout_height

7
ConstraintLayout Overview
• Definition: Flexible layout that positions elements based on constraints
• More efficient for complex UIs
• Key attributes:
• layout_constraintStart_toStartOf
• layout_constraintTop_toTopOf
• layout_constraintBottom_toBottomOf

8
Comparison Table

Layout Type Key Features Best For

RelativeLayout Relative positioning, flexible Simple UIs

FrameLayout Stacks views, simplest layout Overlaying, swapping views

Positioning based on constraints,


ConstraintLayout Complex UIs, responsive design
highly flexible

9
Thank You…!

You might also like