Skip to content
July 17, 2026
  • Privacy Policy
  • Terms & Conditions
  • Write For Us

Eduonix Blog

Learn and Build Your Skills

OpenClaw Masterclass Kickstarter Campaign
Primary Menu
  • Privacy Policy
  • Terms & Conditions
  • Write For Us
  • Home
  • 2012
  • November
  • Linear Layout in Android for Noobs
  • Android Tutorials

Linear Layout in Android for Noobs

Tutor @ Eduonix November 19, 2012 2 minutes read

Layout outlines the structure of the user interface in an Android app. It provides a broader arrangement based on which the UI components can be placed inside an application. There are two ways to define a layout.

XML – The developer can create the layout in the XML file which can be used by the Android app.

Runtime – The user can create views and view group objects programmatically and they get created at the run time.

In our blog today we will create a simple application with few UI elements and will draw them using linear layout. We will be using the XML definition to create the components. This application is not doing anything meaningful but is just a demonstration of the linear layout.

Linear Layout – As the name suggest in this layout the UI components are drawn vertically or horizontally in a single direction. You can define the direction using android:orientation attribute. In linear layout the view group children are defined one after the other. You can define gravity and margins inside a linear layout.

Let us write a simple example to see Linear layout in action.

Steps

1. Create an Android project. I have named it LayoutTest. You can name it whatever you want.
2. Once the project is complete you can see that the SDK has created necessary files and starting code for you.
3. Go to activity_main.xml inside the layout folder in the res folder of the project and change the default XML to the following

Related Articles

Android Featured Image
  • Android Tutorials

Building an Android App with React Native

Tutor @ Eduonix February 6, 2019
Android Studio
  • Android Tutorials

Introduction to Android Development With Android Studio

Tutor @ Eduonix November 9, 2018
Android 9.0 Pie
  • Android Tutorials

Remarkable Features of Android 9.0 Pie

Tutor @ Eduonix September 11, 2018
Copyright © Eduonix Learning Solutions. All rights reserved. | MoreNews by AF themes.