Android Basics – Using gravity and layout_gravity attributes to align View Elements

If you are using Linear Layout you have two attributes available to help you align the UI elements.

Gravity Attribute

Use gravity attribute to align the View Content – center, left, right etc.

Layout Gravity Attribute

Use layout_gravity to align the View element itself.

In the following Video I show you how to use these attributes

Source Code :

Author: Ankur

I am Enthusiastic about Learning new things and sharing my Knowledge. I like programming and have a pretty good background in Computer Science.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: