通用应用程序为平板电脑+手机 [英] Universal App for both tablets+handsets

查看:116
本文介绍了通用应用程序为平板电脑+手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发为平板电脑和handsets..My应用目前在手机上运行良好,一个单一的应用程序(如根据布局和全部)..但我不知道如何分辨它的手机/平板电脑。我看到了一些在Stackoverflow.com的答案也一样,其中一些人回答使用不同的布局大型,布局XLARGE的。

I am developing a single application for both tablets and for handsets..My app is currently running fine on handsets(as according to layouts and all)..but i have no idea for how to distinguish it for handsets/tablets. I have seen some of the answers in Stackoverflow.com too, in which some people answered that use different layout-large,layout-xlarge.

但如果布局不同,我们按照上述方案,那么在编程,它是书面的setContentView(R.layout ---)。

but if the layout differs and we follow the above scenario,then in programming,it is written setcontentView(R.layout.---).

所以我们要在这里提到也是的setContentView(R.layout大型.---)..我很困惑与this..Can有人建议我的东西......

So we have to mention here also that setContentView(R.layout-large.---)..I am so confused with this..Can anyone suggest me something...

推荐答案

您只需要在不同的文件夹中包含的那些同样nameLayout.xml命名

you only need to name the folder differently those contain same nameLayout.xml

像这样

--layout
   -- myLayout.xml
--layout-large
   -- myLayout.xml
--layout-xlarge
   -- myLayout.xml

在code,你只需要使用

on code, you only need to use

secContentView(R.layout.myLayout);

Android将找到适合你的。

android will find the right one for you.

这篇关于通用应用程序为平板电脑+手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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