开发一个通用的Andr​​oid应用程序(手机和平板电脑) - 定义取向 [英] Developing an universal android application (phone and tablet) - Defining Orientations

查看:89
本文介绍了开发一个通用的Andr​​oid应用程序(手机和平板电脑) - 定义取向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个Android应用程序,只支持纵向,Android手机。现在,我需要修改这个程序,因为我想做的通用版本(平板电脑,太),但我有一个问题。手机版本只支持纵向和平板电脑版本支持纵向和横向。有什么办法来定义平板电脑与手机不同的方向?

I have developed an android application, which only supports portrait orientation, for android phones. Now, I need to modify this app because I want to do the universal version (for tablets, too) but I have a problem. The phone version only supports portrait orientation and the tablet version supports portrait and landscape orientations. Is there any way to define different orientations for tablets and phones?

感谢

推荐答案

我相信你可以创建在res /布局文件夹的子文件夹,名为XLARGE土地和XLARGE端口与它们的XML文件。设备本身会知道什么加载XML。

I believe you can create a subfolder in the res/layout folder, called xlarge-land and xlarge-port with the xml files in them. the device itself will know what xml to load.

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

资源: http://developer.android.com/guide/practices/screens_support。 HTML

这篇关于开发一个通用的Andr​​oid应用程序(手机和平板电脑) - 定义取向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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