---
title: "Difference between Gravity and layout_gravity on Android"  
description: "Difference between Gravity and layout_gravity on Android"  
author: "Anonymous User"  
published: 2015-05-22  
updated: 2015-05-22  
canonical: https://www.mindstick.com/forum/23256/difference-between-gravity-and-layout_gravity-on-android  
category: "android"  
tags: ["android"]  
reading_time: 1 minute  

---

# Difference between Gravity and layout_gravity on Android

I know we can set the following [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) to the [android](https://www.mindstick.com/articles/13046/10-reasons-why-i-prefer-android-vs-iphone-ios):gravity and android:layout_gravity.\
centercenter_verticalcenter_horizontal, etc.But I am confused regarding both of these.\
What is the [difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) between the [usage](https://www.mindstick.com/forum/155707/what-is-the-usage-of-asp-dot-net-configuration-file) of android:gravity and android:layout_gravity?

## Replies

### Reply by Anonymous User

Their names should help you:

android:gravity sets the gravity of the content of the View its used on.

android:layout_gravity sets the gravity of the View or Layout in its parent.


---

Original Source: https://www.mindstick.com/forum/23256/difference-between-gravity-and-layout_gravity-on-android

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
