Android Layouts

Let’s discuss about Android Layouts,

Linear Layout

It is a ViewGroup that allows you to align all children vertically or horizontally.

Relative Layout

It is a layout that can be adjusted relatively while created a UI for your app. It is a ViewGroup through which the child views can specify the position relatively to each other and even the parent view.

RelativeLayout can replace nested LinearLayout, which means less code.

Frame Layout

If you want to display only a single item on the screen by blocking out an area, then FrameLayout is the best layout. It’s good to hold a single child view with FrameLayout, since organizing child views can be difficult. This difficulty can arise due to the challenges faced with scalability of child views to different screen sizes. This can lead to children overlapping each other.

Let’s say you still want to add multiple children, for that, assigning gravity to each child, which will also control their position within the FrameLayout. Therefore, use the android:layout_gravity attribute in this case.

Grid View

If you want to display items in a two-dimensional scrollable grid, then use the Grid View ViewGroup.

For example, here’s a grid of images with 20 images i.e 4 columns and 5 rows.

List View

ListView lists a group of scrollable items.

All the layouts are covered separately from the next lesson, starting with Linear Layout.


If you liked the tutorial, spread the word and share the link and our website Studyopedia with others.


For Videos, Join Our YouTube Channel: Join Now


First Android Program
Margin in Android Layout
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading