DEV Community

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

Posted on • Edited on

1

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.

Sentry blog image

The countdown to March 31 is on.

Make the switch from app center suck less with Sentry.

Read more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay