2016-06-05 6 views
0

Ich entwickelte eine Anwendung mehrsprachig Englisch und Persisch. Englisch Layout funktioniert gut und genau das gleiche mit Vorschau in meiner IDE (Android Studio). Aber persische (Farsi) Layouts haben ein Problem in der Laufzeit und sieht nicht wie eine Vorschau, die ich in der IDE vorbereitet. Ich laufe Anwendung im Nexus S5-Samsung Galaxy S6. hat jemand eine Idee ?? [This is English layout in IDE previewThis is Farsi layout (layout-ar) This is what Farsi layout looks like in mobile device looks like its goes wrong dieser farsi Layout-Code (Layout-ar) Farsi Layout in Laufzeit und ändern Schwerkraft

<RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 
     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/relativeLayout"> 


      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_margin="10dp" 
       android:padding="10dp" 
       android:weightSum="10" 
       android:id="@+id/op_successfulLayout" 
       android:background="@drawable/layout_border_op_seccessful"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_weight="5" 
        android:gravity="right" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:id="@+id/trx_result_tv" /> 

       <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/trx__result_img" 
        android:layout_weight="5" 
        android:src="@drawable/green_tick"/> 

      </LinearLayout> 



      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_below="@+id/op_successfulLayout" 
       android:weightSum="10" 
       android:padding="10dp" 
       android:id="@+id/headerReceiptLayout"> 

       <LinearLayout 
        android:orientation="vertical" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_weight="5"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:text="@string/mabna_company_txt" 
         android:id="@+id/company_name_label" 
         android:textColor="@color/black" 
         android:gravity="center" 
         android:layout_gravity="center" 
         /> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/mabna_number_txt" 
         android:layout_gravity="center" 
         android:id="@+id/mabna_number_tv" /> 
       </LinearLayout> 

       <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@drawable/shaparak_img" 
        android:id="@+id/shaparak_img" 
        android:layout_weight="2"/> 
      </LinearLayout> 
      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="@string/receipt_balance" 
       android:id="@+id/trx_type" 
       android:textColor="@color/black" 
       android:layout_weight="2" 
       android:gravity="center" 
       android:layout_below="@id/headerReceiptLayout" 
       android:layout_gravity="center"/> 
     </RelativeLayout> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/relativeLayout" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 
      android:padding="10dp" 
      > 
      <LinearLayout 
       android:id="@+id/receiptLayout" 
       android:orientation="vertical" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 
       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp" 
        > 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/postal_code_tv" 
         android:gravity="left" 
         android:layout_weight="5"/> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/postal_code_txt" 
         android:gravity="right" 
         android:layout_weight="5" 
         android:id="@+id/postal_code_label" /> 

       </LinearLayout> 
       <View android:layout_width="wrap_content" 
        android:id="@+id/line_rec13" 
        android:layout_height="2dp" 
        android:background="@color/gray" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_above="@+id/connection_status" 
        > 
       </View> 

       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/contact_number_tv" 
         android:gravity="left" 
         android:layout_weight="5"/> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/contact_number_txt" 
         android:id="@+id/contact_number_label" 
         android:layout_weight="5"/> 

       </LinearLayout> 

       <View android:layout_width="wrap_content" 
        android:id="@+id/line_rec1" 
        android:layout_height="2dp" 
        android:background="@color/gray" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_above="@+id/connection_status" 
        > 
       </View> 

       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/merchant_name_tv" 
         android:layout_weight="5" 
         android:gravity="left"/> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/merchant_name_txt" 
         android:id="@+id/merchant_name_label" 
         android:layout_weight="5" 
         android:gravity="right"/> 

       </LinearLayout> 
       <View android:layout_width="wrap_content" 
        android:id="@+id/line_rec12" 
        android:layout_height="2dp" 
        android:background="@color/gray" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_above="@+id/connection_status"> 
       </View> 
       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:gravity="right" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp"> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/terminal_id_tv" 
         android:layout_weight="5" 
         android:gravity="left"/> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/terminal_number_txt" 
         android:id="@+id/terminal_id_label" 
         android:layout_weight="5" 
         android:gravity="right"/> 
       </LinearLayout> 
       <View android:layout_width="wrap_content" 
        android:id="@+id/line_rec5" 
        android:layout_height="2dp" 
        android:background="@color/gray" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_above="@+id/connection_status" > 
       </View> 

       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:gravity="right" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp"> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/card_number_tv" 
         android:layout_weight="5" 
         android:gravity="left"/> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/card_number_txt" 
         android:id="@+id/card_number_label" 
         android:layout_weight="5" 
         android:gravity="right"/> 
       </LinearLayout> 
       <View android:layout_width="wrap_content" 
        android:id="@+id/line_rec6" 
        android:layout_height="2dp" 
        android:background="@color/gray" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_above="@+id/connection_status"> 
       </View> 

       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/payment_type_tv" 
         android:layout_weight="5" 
         android:gravity="left"/> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/type_payment_txt" 
         android:id="@+id/payment_type_label" 
         android:layout_weight="5" 
         android:gravity="right"/> 
       </LinearLayout> 
       <View android:layout_width="wrap_content" 
        android:id="@+id/line_rec7" 
        android:layout_height="2dp" 
        android:background="@color/gray" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_above="@+id/connection_status" > 
       </View> 

       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/trace_number_tv" 
         android:layout_weight="5" 
         android:gravity="left"/> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/trace_number_txt" 
         android:id="@+id/trace_number_label" 
         android:layout_weight="5" 
         android:gravity="right"/> 
       </LinearLayout> 
       <View android:layout_width="wrap_content" 
        android:id="@+id/line_rec8" 
        android:layout_height="2dp" 
        android:background="@color/gray" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_above="@+id/connection_status" > 
       </View> 

       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp"> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/date_tv" 
         android:layout_weight="5" 
         android:gravity="left"/> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/payment_date" 
         android:id="@+id/date_label" 
         android:layout_weight="5" 
         android:gravity="right"/> 
       </LinearLayout> 
       <View android:layout_width="wrap_content" 
        android:id="@+id/line_rec9" 
        android:layout_height="2dp" 
        android:background="@color/gray" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_above="@+id/connection_status"> 
       </View> 
       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/RRN_tv" 
         android:layout_weight="5" 
         android:gravity="left"/> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/RRN_txt" 
         android:id="@+id/RRN_label" 
         android:layout_weight="5" 
         android:gravity="right"/> 
       </LinearLayout> 
       <View android:layout_width="wrap_content" 
        android:id="@+id/line_rec4" 
        android:layout_height="2dp" 
        android:background="@color/gray" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_above="@+id/connection_status" > 
       </View> 
       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp"> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/payment_result_tv" 
         android:layout_weight="5" 
         android:gravity="left"/> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/payment_result_txt" 
         android:id="@+id/payment_result_label" 
         android:layout_weight="5" 
         android:gravity="right"/> 
       </LinearLayout> 
       <View android:layout_width="wrap_content" 
        android:id="@+id/line_rec11" 
        android:layout_height="2dp" 
        android:background="@color/gray" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_above="@+id/connection_status" > 
       </View> 
       <LinearLayout 
        android:id="@+id/shenase_qabzLayout" 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp" 
        android:visibility="gone"> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/shenase_qabz_tv" 
         android:layout_weight="5" 
         android:gravity="left"/> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/bill_id_txt" 
         android:id="@+id/shenase_qabz_label" 
         android:layout_weight="5" 
         android:gravity="right"/> 
       </LinearLayout> 
       <LinearLayout 
        android:id="@+id/shenase_pardakhtLayout" 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:weightSum="10" 
        android:padding="5dp" 
        android:layout_marginTop="10dp" 
        android:visibility="gone"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:id="@+id/shenase_pardakht_tv" 
         android:layout_weight="5" 
         android:gravity="left"/> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="@string/payment_id_txt" 
         android:id="@+id/shenase_pardakht_label" 
         android:layout_weight="5" 
         android:gravity="right"/> 
       </LinearLayout> 
       <View android:layout_width="wrap_content" 
        android:id="@+id/line_rec10" 
        android:layout_height="2dp" 
        android:background="@color/gray" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_above="@+id/connection_status" > 
       </View> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:textSize="30dp" 
        android:textStyle="bold" 
        android:layout_marginTop="10dp" 
        android:id="@+id/amount_recepit_tv" 
        android:layout_gravity="center"/> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:id="@+id/fail_opration_guide_tv" 
        android:text="@string/fail_opration_guide_txt" 
        android:layout_gravity="center" 
        android:gravity="center" 
        android:layout_margin="5dp" 
        android:visibility="invisible"/> 
      </LinearLayout> 
     </RelativeLayout> 
    </RelativeLayout> 
</ScrollView> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:id="@+id/linearLayout3" 
    android:weightSum="10"> 
    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="5" 
     android:text="@string/screen_shot_txt" 
     android:id="@+id/screen_shot_btn" 
     android:layout_alignParentTop="true" 
     style="?android:attr/borderlessButtonStyle" 
     android:background="@color/blue_10" 
     android:layout_centerHorizontal="true" 
     android:textColor="@color/white"/> 
    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="5" 
     android:text="@string/confrim_txt" 
     android:id="@+id/receipt_conf_btn" 
     style="?android:attr/borderlessButtonStyle" 
     android:background="@color/blue_10" 
     android:layout_alignParentTop="true" 
     android:textColor="@color/white"/> 
</LinearLayout> 
+0

Schaltflächen Symbole sind auch falsch – BoshRa

Antwort

1

Sie sollten gravity "Start" und "Ende" anstelle von "rechts" und "links" verwenden und dann einfach anwenden die Seite rtl Option

0

wenn Sie "right" Attribut auf Ihre Schwerkraft Gebrauch "end" zu und wenn gesetzt "left" Verwendung "start" zu

wie folgt aus:

android:gravity="right" 
android:gravity="end" 

wenn diese lassen nicht funktioniert hat es mich wissen. Ich habe eine benutzerdefinierte Methode für persische Sprache.

Verwandte Themen