DEV Community

Cover image for ViewGroup in Android {Android Development} | Day 3
Atharva Shirdhankar
Atharva Shirdhankar

Posted on • Edited on

ViewGroup in Android {Android Development} | Day 3

In last blog of Android Development I talked about 3 commonly used views .
And In today's blog I will be discussing about viewgroup.

What are ViewGroup?
In simple terms ViewGroup works as a container in which we can add blocks of views.A ViewGroup is a big View that can contain smaller Views inside of it. The smaller Views are called the children of the ViewGroup and might be TextViews or ImageViews.

Types of ViewGroup👇

  1. LinearLayout
  2. RelativeLayout
    3.ConstraintLayout
    (This is default layout when you create your first project on Android studio.)
    https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayout

  3. FrameLayout

  4. AbsoluteLayout

  5. List View

  6. Grid View
    etc

For instance we will focus on most commonly used Layouts for now👇

  1. LinearLayout
  2. RelativeLayout

1.LinearLayout ⬇️

1.1 What is LinearLayout ?
➡️ It is a view group that aligns all children in a single direction, vertically or horizontally.

(In term of web development)[LinearLayout in Android is similar to Flex in Web Development]
Alt Text

1.2 Attributes of LinearLayout👇

i. android: orientation
➡️ We can specify the layout direction whether we want orientation vertical or horizontal using this attribute.

Top comments (0)