1

I want set TextView direction right to left.
I want that show unicode character right to left and align to right. I set my text view layout_gravity and gravity right but isn't work

<RelativeLayout
    android:layout_width="80dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="-80dp"
    android:layout_marginRight="75dp"  
    android:layout_gravity="right" 
         >
      <Button 
         android:id="@+id/nxtMonth"
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content"
         android:background="@drawable/arrow_top"
         android:layout_marginLeft="22dp"
         />
     <ImageView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content"
         android:src="@drawable/splite_time_new"
         android:layout_marginTop="24dp"
         android:layout_marginLeft="8dp"
         />
     <LinearLayout 
         android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right" 
        android:gravity="right"
        android:layout_marginRight="12dp"
        android:layout_marginTop="19dp"
     >
     <TextView 
        android:id="@+id/txtMonth"
        android:text="Farvardin"
        android:padding="0dip"
        android:gravity="left"

        android:textStyle="bold"
        android:textColor="#FFFFFF"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        />
     </LinearLayout>
     <ImageView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content"
         android:src="@drawable/splite_time_new"
         android:layout_marginTop="50dp"
         android:layout_marginLeft="8dp"
         />
     <Button 
         android:id="@+id/prvMonth"
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content"
         android:background="@drawable/arrow_down"
         android:layout_marginTop="60dp"
         android:layout_marginLeft="22dp"
         />
 </RelativeLayout>


thanx from anyone that help me I really need this but I can't set that

Edited: finally I use this code and this work

 <RelativeLayout
        android:layout_width="70dp"
        android:layout_height="100dp"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true" >

        <Button
            android:id="@+id/nxtMonth"
            android:layout_width="25dp"
            android:layout_height="20dp"
            android:layout_centerHorizontal="true"
            android:background="@drawable/arrow_top" />

        <View
            android:layout_width="60dp"
            android:layout_height="1dip"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="30dp"
            android:background="@drawable/divider_gradient" />

        <View
            android:layout_width="60dp"
            android:layout_height="1dip"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="70dp"
            android:background="@drawable/divider_gradient" />

        <TextView
            android:id="@+id/txtMonth"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:gravity="right"
            android:text="Mehr"
            android:textColor="#FFFFFF" />

        <Button
            android:id="@+id/prvMonth"
            android:layout_width="25dp"
            android:layout_height="20dp"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:background="@drawable/arrow_down" />
    </RelativeLayout>
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Mostafa Rostami
  • 1,906
  • 20
  • 29

1 Answers1

0

Refer the following link, They are discussing for a "Hebrew" text. But I hope it would help you, Right to Left

Community
  • 1
  • 1
  • The Link I referred to you suggests to add "a RIGHT-TO-LEFT MARK character (\u200F)" at the start of your text. For Example, If you are using some string variable to set the android:text attribute of your textview, then in your string variable's value add "\u200F" at the beginning. –  Oct 01 '12 at 08:13
  • i use it doeset work thats only show unicode character i want right to left my layout not in code thats not work for me – Mostafa Rostami Oct 01 '12 at 13:16