1

Hi does anyone know how to implement a layout change in the application. For example, when a user sees a text box prompt and turns the phone sideways and views the application as a landscape view. I have no idea how to go forward with this?

May I add that I know I have to create a layout-land xml. I'm ok with that bit, it's just I'm not sure how to make the phone automatically detect that it is oriented sideways and needs to implement the landscape view.

Many thanks.

Superunknown
  • 501
  • 2
  • 10
  • 30
  • You just need 2 layout files with the same name, one in res/layout/ and the other in res/layout-land/. The system will automatically choose the right one for you. – Joseph Earl May 05 '11 at 15:57

1 Answers1

0

If the phone supports orientation changes and you've turned it on in Settings (Display > Auto-rotate screen) everything should work automatically. The Activity will be restarted and the correct layout file used.

See this post here för details: Android: alternate layout xml for landscape mode

Community
  • 1
  • 1
TofferJ
  • 4,678
  • 1
  • 37
  • 49