如何在我的Andr​​oid应用程序将在多个屏幕分辨率的设备上运行? [英] How my android app will run on multiple screen resolution devices?

查看:91
本文介绍了如何在我的Andr​​oid应用程序将在多个屏幕分辨率的设备上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个Android应用程序,并在一个模拟器HVGA运行它。它的任何HVGA设备即于mdpi上成功运行。但是,如果我尝试在QVGA即小屏幕分辨率的设备,那么我的按钮看上去好像他们下去,不适合到小屏幕上运行...

I have developed an android application and run it on an HVGA emulator. It's running successfully on any HVGA device i.e. mdpi. But if I try to run on small screen resolution devices i.e QVGA then my buttons are looking as if they go down and dont fit onto the small screen...

所以,我怎么能运行我在多个屏幕分辨率的Andr​​oid应用程序成功?

So how can I run my android application on multiple screen resolution successfully?

推荐答案

按照下列指示


  1. 创建于yourAppFolder / RES文件夹/命名布局小(*更多关于这个主题后)

  2. 插入此文件夹需要为小屏幕特别处理所有的XML布局的项目(这是没有必要复制所有的正常的布局文件,但你可以,如果你愿意的话)在

  3. 在此布局需要改变的文件

这种方法会发生什么:

如果设备有一个非小屏幕,默认布局(一个在布局文件夹中)将被装载和使用,否则,如果屏幕处于小类别中的布局小,将文件用来代替(只有当一个人具有相同的名称可用,否则将被用于所述一个中的布局

if the device has a non-small screen, the default layout (the one in "layout" folder) will be loaded and used, otherwise if the screen is in "small" category the files in "layout-small" will be used instead (only if one with the same name is available, otherwise the one in "layout" will be used

*有关文件夹命名:该政策是旧的Andr​​oid支持。现在还有另外一种更precise但更复杂的太(例如:指定最低限度的必要宽度)。无论如何,这仍然受支持,只是注意,日食可能会建议你一些替代品。目前,我仍然用旧命名策略发展。

*About folder naming: that policy was the old one supported by android. Nowadays there is another one, more precise but more complex too (example: specify minimum necessary width). Anyway, this is still supported, just note that eclipse may suggest you some alternatives. Currently, i am still developing with the old naming policy.

这篇关于如何在我的Andr​​oid应用程序将在多个屏幕分辨率的设备上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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