DEV Community

Cover image for ViewGroup: RelativeLayout in Android {Android Development} | Day 4
Atharva Shirdhankar
Atharva Shirdhankar

Posted on

ViewGroup: RelativeLayout in Android {Android Development} | Day 4

More about RelativeLayout

In last blog I talked about viewgroup, then we have a glance over different types of viewgroups
And lastly we jumped towards LinearLayout.

In today's blog we will have a look over RelativeLayout👇

2.Relative Layout⬇️

What is RelativeLayout?
RelativeLayout is a view group that displays child views in relative positions.
The position of each view can be specified as relative to sibling elements (such as to the left-of or below another view) or relative to parent layout.

If I want to explain Web developer about RelativeLayout .
I would say Relative Layout in Android is similar to css grid .
You can position childblocks(TextView,button, ImageView etc) relative to each other or to the parent class that is RelativeLayout.

Properties of RelativeLayout:

  1. android:layout_alignParentTop ➡️ If "true", makes the top edge of this view match the top edge of the parent.
  2. android:layout_centerVertical ➡️ If "true", centers this child vertically within its parent.

And many more properties,
Read more about RelativeLayout 👇
https://developer.android.com/guide/topics/ui/layout/relative

Top comments (0)