如何在Android应用程序开发中为所有类型的手机设置相同的分辨率? [英] how to set same resolution for all type of mobile in android application development?

查看:91
本文介绍了如何在Android应用程序开发中为所有类型的手机设置相同的分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi sir,
  how to set same resolution for all type of mobile in android. Kindly give me the solution for this problem.

推荐答案

无法完成。

即使您实现了一些缩放方法,也可以将整个UI或游戏绘制到虚拟画布上,然后缩放(向上或向下) )为适应屏幕,您仍会遇到纵横比不同的问题。



/ Fredrik
It cannot be done.
Even if you implemented some scaling-method drawing your entire UI or game to a virtual canvas that was then scaled (up or down) to fit the screen you would still run into issues with aspect ratios being different.

/Fredrik


你做不到 - 考虑一下,你会明白为什么:android在我所知道的426x320到1920x1200的设备上运行:如果你尝试使用这两款相同的分辨率,那么它们看起来都很糟糕!



什么是你试图这样做你认为这是个好主意吗?
You can't do it - think about it for a moment, and you will see why: android runs on devices from 426x320 to 1920x1200 that I know of: if you try to use is as the same resolution on those two it will look terrible on both!

What are you trying to do that you think this would be a good idea?


我想说不要为特定的分辨率设计。使用 wrap_content layout_width layout_width layout_height 值的组合来获取 wrap_content match_parent 的值不同的比例宽度取决于屏幕尺寸,而不是硬编码像素值。并且还使用 dp (与设备无关的像素),因为它也会根据密度略有变化,因此无论分辨率如何,它都保持一致的物理尺寸。

并进行以下研究:

支持多个屏幕 [ ^ ]

< a href =http://stackoverflow.com/questions/11311943/which-screen-resolution-should-i-consider-while-designing-an-android-application>在设计Android应用程序时,我应该考虑哪个屏幕分辨率 [ ^ ]
I would say don't design for a specific resolution. Use combinations of layout_weight, layout_width and layout_height values of wrap_content and match_parent to get different proportional widths depending on the screen size, rather than hard coding pixel values. And also use "dp"(device-independent pixel), because it also changes slightly depending on the density, so that it stays a consistent physical size no matter what the resolution is.
And have a study with these:
Supporting Multiple Screens[^]
Which screen resolution should i consider while designing an android application[^]


这篇关于如何在Android应用程序开发中为所有类型的手机设置相同的分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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