I have done some experiments with Relative Layout gravity in Android Studio. I am very perplexed with results gotten. Let's look at my xml.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top" >
<Button
android:text="Apple"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="20dip" />
</RelativeLayout>
When I set android:gravity to left, right, or bottom I get the proper gravity effects. The view is moved to left, right or bottom correspondingly. However if I set android:gravity to top I get no any visible effect.
There are several other oddities for me. Value left, right, end moves the view but value start doesn't. Why? IMHO if we use LTR the "start" has to be equal to the left. I know that value start|top is the default value for gravity but it doesn't help me to understand the problem. Please help me to clarify the situation. Thank you.