如何设置纵向和横向的单一的应用程序 [英] How to set both portrait and landscape in single App

查看:116
本文介绍了如何设置纵向和横向的单一的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小小的疑问,在开发Android应用的用户界面,可在纵向和横向模式下使用。它是如何能够做到这一点?有人可以简单解释?

I have a small doubt, While developing an Android App whose user interface can be used in both portrait and landscape modes. How it is possible to achieve this? Can someone explain briefly?

推荐答案

要做到这一点,你需要为纵向和横向创建具有相同名称的两个不同的XML文件,并把它放在各自的文件夹。

To achieve this you need to create two different xml files with same name for portrait and landscape and put it in respective folders.

MyProject/
    res/
        layout/              # default (portrait)
            main.xml
        layout-land/         # landscape
            main.xml

这篇关于如何设置纵向和横向的单一的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆