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
madmareAsked:
Who is Participating?
 
Dejan PažinConnect With a Mentor Head of SW DevelopmentCommented:
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
 
Dejan PažinHead of SW DevelopmentCommented:

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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Dejan PažinHead of SW DevelopmentCommented:

Yes.
0
 
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žinHead of SW DevelopmentCommented:

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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.