Search code examples
androidorientationviewflipper

Force orientation depending on the View inside ViewFlipper


I have a ViewFlipper with several ScrollViews inside. Depending on the child ScrollView I need to force the ViewFlipper's orientation to portrait or landscape. How can I achieve this ? Thanks.


Solution

  • Take a look at http://developer.android.com/guide/practices/screens_support.html and http://developer.android.com/reference/android/widget/HorizontalScrollView.html

    In the first document, note that you can provide different layout files for landscape versus portrait modes. For example, for landscape mode, you could have a layout file in res/layout-land.

    If you want more help putting the pieces together, just ask.


    Edit: It looks like I misread the original question. Take a look at these two posts:

    1. Force an Android activity to always use landscape mode

    2. Android force Horizontal (landscape) layout