本文主要是介绍android studio layouts,Android Studio: Creating landscape layouts,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
问题
Until recently I used Eclipse, and in Eclipse I simply created a folder /res/layout-landscape and put alternate landscape layouts inside.
However, it seem in Android Studio 1.1.0, I can't do it that way. How do I create the folder for alternate landscape layouts?
回答1:
You can actually use layout-land in Android Studio as well it will show up in your res directory like so:
If it doesn't show up make sure to have your project scope set to Project and not Android.
If you still don't see one you can create one by right clicking on the res directory and selecting New -> Android resource directory and filling out the prompt below.
Also, once it's been created, you can easily switch from portrait to landscape in the layout preview via the orientation button found on the toolbar above the layout preview. It is pictured below:
回答2:
You can also use option given in below image.
I hope you have understood.
回答3:
The accepted answer is actually seriously outdated. In Android Studio 3.x.x, there is no need to create an extra layout folder (I am not sure this was necessary back then anyway).
There is also no need to change the project scope from Android to Project as the accepted answer tells you to.
There is also no need to edit any UI attributes and modes as the accepted answer says.
There are just 2 steps:
1) Open your base UI layout in DESIGN mode so that you see the actual GUI, such as buttons, icons etc. (do NOT open it as text, in the XML code view mode).
2) Click the icon marked in the below screenshot and, from the menu, select Create Landscape Variation (marked in the screenshot as 'Click 2nd').
Then, the Studio does all the job for you and it works like a charm. No need to add any extra code and no extra folders are created.
Enjoy.
Android Studio 3.1.4:
回答4:
MrEngineer13's answer is spot on.
The only thing that I would add is that his screenshot may lead you to believe that you should be selecting 'UI Mode' from the 'Available qualifiers' list.
Just to clarify: after filling out the Directory name and Resource type, select 'Orientation' from Available qualifiers, which will lead you to the screenshot that MrEngineer13 provided.
回答5:
In the Project -> app -> src -> main -> res
Then Create Android resource directory, choose Orientation
来源:https://stackoverflow.com/questions/28815769/android-studio-creating-landscape-layouts
这篇关于android studio layouts,Android Studio: Creating landscape layouts的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!