Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1935
  • Last Modified:

Android application support RTL

Hi,
 I have developet Android application which display RSS news

 I'm using the Radio buttons & Test View

 how do I set the application to suopport RTL Direction ??

Thanks
0
madmare
Asked:
madmare
  • 4
  • 3
1 Solution
 
Dejan PažinCommented:

I guess you need Arabic locales for that. If you compare the android version 2.2 and 2.3, you will notice that 2.3 has Arabic support, while 2.2 does not:

http://developer.android.com/sdk/android-2.2.html

http://developer.android.com/sdk/android-2.3.html

There are suggestions to use webkit control, see here:

http://stackoverflow.com/questions/2584245/android-rtl-support-digits-embedded-in-a-right-to-left-sentence-hebrew
0
 
madmareAuthor Commented:
i need Hebrew, not arabic

 is it the same ?
0
 
Dejan PažinCommented:

Yes.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
madmareAuthor Commented:
I don't have any problem with the fonts, all what i need that the fonts in TextView be aligned to the rigth

0
 
Dejan PažinCommented:

I am not sure I understand now. I thought you needed RTL support?

To justify text to the right try this:

tv.setGravity(Gravity.RIGHT);
0
 
madmareAuthor Commented:
unfortunatly it still aligned to the left after I had inserted the: tv.setGravity(Gravity.RIGHT);

0
 
Dejan PažinCommented:
Here is a sample that works, try it:

public class MyActivity extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        LinearLayout layout = new LinearLayout(this);
        TextView tv  = new TextView(this);
        tv.setText("test");
        tv.setGravity(Gravity.RIGHT);
        tv.setBackgroundColor(Color.WHITE);
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        layout.addView(tv, lp);
        setContentView(layout);
    }
}
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now