I have placed a GridView in my XML layout file.
It is displayed as I wanted in the English (LTR) on both API 17-21 But when I witch the language to Arabic (RTL) the horizontalSpacing is ignored on API 17-19 but on API 21 it is displayed as I wanted.
The same behavior occurred on emulators and real Android devices.
XML code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/services_home_main_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/services_home_contents"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_above="@+id/services_home_bottom_layout">
<GridView
android:id="@+id/services_home_services_gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="3"
android:horizontalSpacing="4dp"
android:verticalSpacing="4dp"
android:layout_margin="4dp"
android:gravity="center"
android:choiceMode="singleChoice" />
</LinearLayout>
<LinearLayout
android:id="@id/services_home_bottom_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
XML code for items:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/services_drawer_item_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:padding="4dp"
android:background="@color/Gray_CC"
android:drawableTop="@drawable/tall4"
android:text="@string/app_name" />
Here is my screenshots of Arabic (RTL) UI:
Notice the horizontal spacing in the first screenshot