How to set orientation in two different mode , in two layout?

前端 未结 4 1319
猫巷女王i
猫巷女王i 2021-01-07 17:26

I have layout that is called Main.XML and I set the orientation to portrait in my AndroidManifest.xml. I designed this layout for Honeycomb too and

4条回答
  •  [愿得一人]
    2021-01-07 17:41

    I think this could be done like this:

    1. Detect screen size programmtically in you onCreate. http://www.mail-archive.com/android-developers@googlegroups.com/msg144381.html

    2. Set orientation according to screen size, like this:

      if(screen size is large) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); else setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    Not sure if it's the best way though.

提交回复
热议问题