Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between gravity right and end [duplicate]

I was making a xml file and was applying gravity to make view content to shift it to extreme right side of window but i saw gravity as right and end.So, what is the actual difference between the both and which one to use where.

like image 775
Suhail Mehta Avatar asked Mar 19 '23 06:03

Suhail Mehta


2 Answers

in Arabic, Persian and all rtl (Right-To-Left) Locales, end is left but for English and other ltr (Left-To-Right) Locales end means right

like image 108
Sepehr Behroozi Avatar answered Mar 24 '23 09:03

Sepehr Behroozi


Left and right gravities might not work correctly in applications localized for right-to-left languages like Hebrew, Arabic etc. In those languages left and right sides are mirrored to european languages. If you use hardcoded left and right gravities for some elements of your UI, then they might be misplaced in right-to-left localizations. If you use begin and end, then Android will map them correctly to left or right depending on current system language. Thus begin for English is equal to left and for Hebrew to right etc.

If you app has a localization for one of right-to-left languages, then you should always use begin and end. Otherwise you can safely stay with left and right.

like image 20
sergej shafarenka Avatar answered Mar 24 '23 09:03

sergej shafarenka