0

I tried to arrange my icons in main screen in English version & it's ok, but when switch the language to Arabic Version, main screen works with unsuitable arrangement each icon in place far of another..

How I can solve this problem ??

English version screen

Arabic version screen

this is a whole main screen XML code :

<RelativeLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/pic2"
android:gravity="clip_vertical|clip_horizontal"
android:orientation="vertical"
android:padding="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_vertical_margin"
android:paddingTop="@dimen/activity_horizontal_margin"
tools:context=".MainActivity" >

    <Button
        android:id="@+id/courses"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/academic_text "
        android:layout_alignRight="@+id/contacts_text "
        android:background="@drawable/courses" />

    <TextView
        android:id="@+id/contacts_text "
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/contacts"
        android:layout_centerHorizontal="true"
        android:layout_weight="0.00"
        android:text="@string/contacts"
        android:textColor="@color/lomon_chiffon"
        android:textSize="12sp"
        android:textStyle="italic"
        android:typeface="serif" />

    <Button
        android:id="@+id/ouwebsite"
        android:layout_width="33dp"
        android:layout_height="33dp"
        android:layout_alignBaseline="@+id/aouwebsite"
        android:layout_alignBottom="@+id/aouwebsite"
        android:layout_toLeftOf="@+id/aouwebsite"
        android:background="@drawable/ou_website1" />

    <TextView
        android:id="@+id/courses_text "
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/courses"
        android:layout_below="@+id/courses"
        android:text="@string/courses"
        android:textColor="@color/lomon_chiffon"
        android:textSize="12sp"
        android:textStyle="italic"
        android:typeface="serif" />

    <Button
        android:id="@+id/aouwebsite"
        android:layout_width="33dp"
        android:layout_height="33dp"
        android:layout_alignBaseline="@+id/facebook"
        android:layout_alignBottom="@+id/facebook"
        android:layout_toLeftOf="@+id/facebook"
        android:background="@drawable/aou_website99" />

<Button
    android:id="@+id/facebook"
    android:layout_width="33dp"
    android:layout_height="33dp"
    android:layout_alignBaseline="@+id/twitter"
    android:layout_alignBottom="@+id/twitter"
    android:layout_toLeftOf="@+id/twitter"
    android:background="@drawable/facebook" />

<Button
    android:id="@+id/contacts"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/about"
    android:layout_alignBottom="@+id/about"
    android:layout_alignRight="@+id/courses_text "
    android:background="@drawable/contacts" />

<TextView
    android:id="@+id/about_text "
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/about"
    android:layout_below="@+id/about"
    android:layout_weight="0.00"
    android:text="@string/about"
    android:textColor="@color/lomon_chiffon"
    android:textSize="12sp"
    android:textStyle="italic"
    android:typeface="serif" />

<TextView
    android:id="@+id/news_text "
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/about"
    android:layout_alignLeft="@+id/student"
    android:layout_weight="0.00"
    android:text="@string/news"
    android:textColor="@color/lomon_chiffon"
    android:textSize="12sp"
    android:textStyle="italic"
    android:typeface="serif" />

<TextView
    android:id="@+id/academic_text "
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/academic_calendar"
    android:layout_below="@+id/academic_calendar"
    android:layout_weight="0.00"
    android:text="@string/academic_calendar"
    android:textColor="@color/lomon_chiffon"
    android:textSize="12sp"
    android:textStyle="italic"
    android:typeface="serif" />

<Button
    android:id="@+id/about"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/academic_text "
    android:layout_below="@+id/academic_text "
    android:layout_marginTop="24dp"
    android:background="@drawable/about1" />

<Button
    android:id="@+id/twitter"
    android:layout_width="33dp"
    android:layout_height="33dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:background="@drawable/twitter" />

<Button
    android:id="@+id/academic_calendar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/facebook"
    android:layout_alignParentTop="true"
    android:background="@drawable/calendar" />

<Button
    android:id="@+id/news"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/news_text "
    android:layout_alignLeft="@+id/news_text "
    android:background="@drawable/news1" />

<Button
    android:id="@+id/student"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/student_text "
    android:layout_marginRight="40dp"
    android:layout_toLeftOf="@+id/contacts_text "
    android:background="@drawable/email" />

<TextView
    android:id="@+id/student_text "
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/contacts"
    android:layout_marginRight="26dp"
    android:layout_toLeftOf="@+id/contacts_text "
    android:layout_weight="0.00"
    android:text="@string/student_email"
    android:textColor="@color/lomon_chiffon"
    android:textSize="12sp"
    android:textStyle="italic"
    android:typeface="serif" />

Blundell
  • 75,855
  • 30
  • 208
  • 233

1 Answers1

0

Here's some pseudo Android xml. This would get you three icons that are equally spaced across the screen. The language won't matter because the text will just go onto two lines if it happens to take up more than 33% of the screen.

Just use two of these in your relative layout:

<LinearLayout
   android:layout_width = "match_parent"
   android:layout_height = "wrap_content"
   android:orientation = "horizontal" >

  <TextView
     android:layout_width = "0dip"
     android:layout_height = "wrap_content"
     android:drawableTop = "@drawable/news"
     android:text = "@string/news" 
     android:layout_weight = "33" />

  <TextView
     android:layout_width = "0dip"
     android:layout_height = "wrap_content"
     android:drawableTop = "@drawable/course"
     android:text = "Courses" 
     android:layout_weight = "33" />

  <TextView
     android:layout_width = "0dip"
     android:layout_height = "wrap_content"
     android:drawableTop = "@drawable/calendar"
     android:text = "Calendar" 
     android:layout_weight = "33" />

</LinearLayout>

(just haven't got time to do it all for you :p )

Blundell
  • 75,855
  • 30
  • 208
  • 233