Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7637917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:03:03+00:00 2026-05-31T08:03:03+00:00

I am developing an Android app to support both En/Ar. But I faced a

  • 0

I am developing an Android app to support both En/Ar. But I faced a problem that if the user changes from En to Ar the alignment of the user interface must turns from “left to right” to “right to left”.

Example: (TextView)(EditText) this is in En

But in Ar it should be: (EditText)(TextView).

Is there a way to do this without creating two different layouts or two different versions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:03:04+00:00Added an answer on May 31, 2026 at 8:03 am

    Why can’t this be done with two layouts (you never said why this is not desireable)? As described by the Android Developers documentation

    A large part of localizing an application is providing alternative
    text for different languages. In some cases you will also provide
    alternative graphics, sounds, layouts, and other locale-specific
    resources.

    An application can specify many res// directories, each
    with different qualifiers. To create an alternative resource for a
    different locale, you use a qualifier that specifies a language or a
    language-region combination.

    Ref: http://developer.android.com/guide/topics/resources/localization.html

    So in your case create res/layout-ar then copy your existing layout into this folder and then simply swap them round. Simple, follows best practices and is easy to do. This also makes any further localisation changes easier going forward without having to write more code.

    If you were to write code you are going to need to find the default language of the device and then swap the Views based on this. You can get the language by:

    Locale.getDefault().getDisplayLanguage();
    

    See this question for more detail: Get the current language in device

    On a final personal note: I think the former is a much better separation of concerns, as the code provides logic and the XML layouts actually control the layout (with Android selecting the right resources automagically for you without having to write any more code).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently developing an Android app that is supposed to inform the user
I am developing an Android App that gets some data from a web server,
I'm developing an Android app that absolutely needs to support Android 2.1+ devices, including
I am developing an android app for android smartphones but want to support tablets,
I am developing an app for android where I need some data from a
I'm developing android app. It's some sort of social network. Where user can add
I'm developing an Android app that receives a byte array that is a GSM
We're developing an Android app that relies on the accelerometer for certain features. I'm
I am developing Android app in eclipse with Android SDK 2.3, but i am
I am developing an Android app that should be capable of streaming video to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.