4

Please view the image below:

enter image description here

The first image is the layout I did and it show normally on my device and another test devices. The second image is the layout showed on my friend device, it is reversed. I do not know why, and it just happened on few devices.

This is my layout code on xml.

<?xml version="1.0" encoding="utf-8"?>

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:auto="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/coordinatorLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".activities.ComposeSmsActivity">


    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <include
            android:id="@+id/toolbar"
            layout="@layout/toolbar_action" />

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:padding="@dimen/padding_5">

                <com.hnib.smslater.views.FlowLayout
                    android:id="@+id/layout_name_recipient"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/margin_10"
                    android:fontFamily="sans-serif-light"
                    android:orientation="horizontal">

                </com.hnib.smslater.views.FlowLayout>


                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="@dimen/padding_10">

                    <com.hnib.smslater.views.ClearableAutoContactCompleteTextView
                        android:id="@+id/et_recipient"
                        android:layout_width="@dimen/width_et_contact"
                        android:layout_height="@dimen/height_et_default"
                        android:layout_centerVertical="true"
                        android:layout_marginTop="@dimen/margin_10"
                        android:background="@drawable/drawable_radius_gray_gray"
                        android:fontFamily="sans-serif-light"
                        android:hint="@string/to_"
                        android:imeOptions="actionDone"
                        android:padding="@dimen/padding_5"
                        android:textColorHint="@color/gray"
                        android:textSize="18sp"
                        android:textStyle="bold"
                        auto:displayPhotoIfAvailable="false"
                        auto:styleOfTypedLetters="bold"
                        auto:typeOfData="phone"
                        auto:typedLettersHaveDifferentStyle="true" />


                </RelativeLayout>


                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/margin_5"
                    android:layout_marginTop="10dp">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:fontFamily="sans-serif-light"
                        android:text="@string/message"
                        android:textColor="@color/gray"
                        android:textSize="18sp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/tv_message_length"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:fontFamily="sans-serif-light"
                        android:text="160/1" />

                </RelativeLayout>


                <com.hnib.smslater.views.ActionEditText
                    android:id="@+id/et_text_content"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/height_et_big"
                    android:layout_marginLeft="@dimen/margin_5"
                    android:background="@drawable/drawable_radius_gray_gray"
                    android:ems="10"
                    android:fontFamily="sans-serif-light"
                    android:gravity="top"
                    android:inputType="textMultiLine"
                    android:maxLines="10"
                    android:padding="@dimen/padding_5"
                    android:scrollbars="vertical" />

                <RelativeLayout
                    android:id="@+id/layout_time"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:padding="@dimen/padding_10"
                    android:showDividers="middle">

                    <TextView
                        android:id="@+id/tv_title_time"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerVertical="true"
                        android:background="@drawable/drawable_radius_acent_gray"
                        android:fontFamily="sans-serif-light"
                        android:padding="@dimen/padding_5"
                        android:text="@string/time"
                        android:textAllCaps="true" />

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_toRightOf="@+id/tv_title_time"
                        android:divider="?android:attr/dividerVertical"
                        android:gravity="center_vertical"
                        android:orientation="horizontal"
                        android:padding="@dimen/padding_10"
                        android:showDividers="middle">

                        <TextView
                            android:id="@+id/tv_date"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:background="@drawable/selector_textview"
                            android:fontFamily="sans-serif-light"
                            android:gravity="center_horizontal"
                            android:text="12/06/2016"
                            android:textColor="@color/gray"
                            android:textSize="27sp"
                            android:textStyle="bold" />


                        <TextView
                            android:id="@+id/tv_time"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:background="@drawable/selector_textview"
                            android:fontFamily="sans-serif-light"
                            android:gravity="center_horizontal"
                            android:text="09:10"
                            android:textColor="@color/gray"
                            android:textSize="27sp"
                            android:textStyle="bold" />


                    </LinearLayout>

                </RelativeLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:gravity="center_vertical"
                    android:orientation="horizontal"
                    android:padding="@dimen/padding_10">

                    <TextView
                        android:id="@+id/tv_title_repeat"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="30dp"
                        android:background="@drawable/drawable_radius_acent_gray"
                        android:fontFamily="sans-serif-light"
                        android:padding="@dimen/padding_5"
                        android:text="@string/repeat"
                        android:textAllCaps="true" />

                    <Spinner
                        android:id="@+id/spinner_repeat"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"></Spinner>

                </LinearLayout>

                <LinearLayout
                    android:id="@+id/layout_choose_sim"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:gravity="center_vertical"
                    android:orientation="horizontal"
                    android:padding="@dimen/padding_10">

                    <TextView
                        android:id="@+id/title_choose_sim"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="30dp"
                        android:background="@drawable/drawable_radius_acent_gray"
                        android:fontFamily="sans-serif-light"
                        android:padding="@dimen/padding_5"
                        android:text="@string/choose_sim"
                        android:textAllCaps="true" />

                    <Spinner
                        android:id="@+id/spinner_choose_sim"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"></Spinner>
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/layout_confirm"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:gravity="center_vertical"
                    android:orientation="horizontal"
                    android:padding="@dimen/padding_10">

                    <TextView
                        android:id="@+id/tv_title_confirm"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="15dp"
                        android:background="@drawable/drawable_radius_acent_gray"
                        android:fontFamily="sans-serif-light"
                        android:padding="@dimen/padding_5"
                        android:text="@string/ask_before_send"
                        android:textAllCaps="true" />

                    <CheckBox
                        android:id="@+id/checkbox_confirm"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_marginLeft="20dp"
                        android:layout_toRightOf="@+id/tv_title_confirm" />

                </LinearLayout>


            </LinearLayout>


        </ScrollView>


    </LinearLayout>


</android.support.design.widget.CoordinatorLayout>

Please have a help on this issue. Thanks.

Leszek Jasek
  • 2,206
  • 1
  • 23
  • 30
CauCuKien
  • 1,027
  • 2
  • 15
  • 26
  • 3
    this is because your freind phone is set to arabic support that is right to left, therefore – Maytham Fahmi Aug 21 '16 at 18:09
  • 1
    your friend has their device set to a language that is written RTL – Hector Aug 21 '16 at 18:09
  • Look at his notification area, the whole display is reversed – ElefantPhace Aug 21 '16 at 18:10
  • does language like arabic language really effect the whole display to be reversed? Shouldn´t it be only the text? – Opiatefuchs Aug 21 '16 at 18:13
  • 2
    @opiatefuchs yes. http://stackoverflow.com/questions/27378921/the-project-references-rtl-attributes-but-does-not-explicitly-enable-or-disable – ElefantPhace Aug 21 '16 at 18:14
  • very interesting..... – Opiatefuchs Aug 21 '16 at 18:30
  • 1
    @Opiatefuchs It does and should. People in LTR languages track the screen left to right. If you see lists in those languages, you'll see the item numbers on the right. This is why you have the toStartOf and toEndOf in relative layouts, and gravity start and end- so they can automatically flip everything. – Gabe Sechan Aug 21 '16 at 18:38

3 Answers3

6

The language on your friend's phone is probably different from yours, leading to the app giving a read from right to left, rather than your left to right. Does your friend have his phone's settings on language set to Hebrew or Arabic?

Edit: please take note of the answers below mine, those are the viable options for your friend's phone, besides for changing the language of course.

Anish Rao
  • 76
  • 5
4

You should remove android:supportsRtl="true" from the <application> element in your AndroidManifest.xml file.

G. Spyridakis
  • 431
  • 1
  • 10
  • 21
4

You should ADD : android:supportRTL="false"

In the manifest