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

前端 未结 4 1258
猫巷女王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:47

    You can place your main.xml in layout-xlarge-land, then it will be used only in landscape orientation
    Refer Supporting Multiple Screens (Using configuration qualifiers)

    Android supports several configuration qualifiers that allow you to control how the system selects your alternative resources based on the characteristics of the current device screen. A configuration qualifier is a string that you can append to a resource directory in your Android project and specifies the configuration for which the resources inside are designed.

    Edit: If you provide an main.xml in layout folder and another main.xml in layout-xlarge-land, then

    • for an extra large landscape orientation it will take the main.xml from layout-xlarge-land

    • for all other, that is in landscape or portrait orientation it will take the main.xml from layout

    Refer Providing Alternative Resources for more details

提交回复
热议问题