0

Hi I'm new to android world. I'm working on an application that supports arabic and english languages.So I made my design for english language in the xml and through the code when the user wants to work with arabic language I change the gravity of my widgets to match the arabic right-to-left look.

Now I have 2 questions:- 1-Will I have to implement virtual arabic keyboard?

2-I have a list that shows a forum's threads to start from right-to-left.To make this list I have 2 xmls one for the list and the other for the list's row. When the user's language is arabic I make ALIGN_PARENT_RIGHT for each widget in my xmls. It works for the list xml but when I try to make this for the list's row It throws source not found exception.

Could help me?

    //threads row
//lastPost
tvThread=(TextView)findViewById(R.id.txtLastPost);

    //here it throws the exception
params = (RelativeLayout.LayoutParams)tvThread.getLayoutParams();
params.setMargins(20, 0, 0, 0);
FAFI
  • 379
  • 2
  • 6
  • 21

1 Answers1

0

If your TextView is contained within some other Layout Element, and not a direct child of your RelativeLayout (likely) you shouldn't cast it's params as relativelayout. Cast it as whatever it's container layout is, or just use generic LayoutParams. Should work fine as

// params defined somewhere previously as something like LayoutParams params;
params = tvThread.getLayoutParams();
params.setMargins(20, 0, 0, 0);
Eric
  • 1,953
  • 4
  • 24
  • 33
  • It's a direct child of my relative layout. But I also tried to do as u told me. Still not working it throws the same exception at this: params = tvThread.getLayoutParams(); :'( .By the way, this layout not in the xml that I setcontentview. Would that be the reason of my problem? – FAFI Jun 07 '11 at 08:35