如何在 Android 中设计任何屏幕尺寸和密度(Android 中的手机多屏) [英] how to design any screen size and - density in Android(Multi screen for mobiles in Android)

查看:28
本文介绍了如何在 Android 中设计任何屏幕尺寸和密度(Android 中的手机多屏)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用值文件夹中的维度的情况下处理 Android 手机的多屏设计.

我的应用程序支持所有安卓手机,但我的设计有问题,因为我在 values 文件夹中使用 dimen 来处理它.

所以请任何人都可以帮助我在不使用维度的情况下处理这个问题.

解决方案

布局兼容性对于任何项目都是非常重要的部分

抱歉,您必须使用尺寸来处理此问题.我认为最好的设计方式是使用密度.

您可以使用 dimens-hdpidimens-mdpi 或 ...

并且可以使用 dimens-smalldimens-large 或 ...

并且可以同时使用它们.如dimens-larg-mdpi

但这很难设计.

我使用尺寸最小的屏幕宽度这种使用密度,我认为您可以通过 4 或 5 个维度处理所有手机或平板电脑.

喜欢这张图片.

屏幕宽度 dp 的典型数字是:

  • 320:手机屏幕(240x320 ldpi、320x480 mdpi、480x800 hdpi 等).
  • 480:像 Streak 一样的 tweener 平板电脑 (480x800 mdpi).
  • 600:7 英寸平板电脑 (600x1024).
  • 720:10 英寸平板电脑(720x1280、800x1280 等).
  • 如果您的设备不支持其中之一,您可以添加另一个最小的屏幕宽度.

您可以在

  • 第一个公式可帮助您计算每英寸像素数 (dpi).
  • 第二个公式可帮助您计算像素比率.
  • 最后一个公式可帮助您计算 dp.

这款手机的宽度为 392 dp,最小宽度为 320.

如果您喜欢使用 dpi 像素比 可以帮到你.

  • ldpi => 像素比 = 0.75
  • mdpi => 像素比 = 1.0
  • hdpi => 像素比 = 1.5
  • xhdpi => 像素比 = 2
  • xxhdpi => 像素比 = 3
  • xxxhdpi => 像素比 = 4

How to handle design in multi screen for mobiles in Android without using dimention in values folder.

My application it's support all android mobiles, and I had a problem with the design, because I'm using dimen in values folder to handle it.

So please anyone can help me to handle this problem without using the dimention.

解决方案

layout compatibility is very important part of any project

sorry but you have to use dimens for handle this problem. and i think best way for design is use density.

you can use dimens-hdpi or dimens-mdpi or ...

and can use dimens-small or dimens-large or ...

and can use both of them together. like dimens-larg-mdpi

but this is so hard to design.

i using dimens smallest screen width this use density and i think you can handle all of phones or tablets by 4 or 5 dimens.

like this picture.

Typical numbers for screen width dp are:

  • 320: a phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
  • 480: a tweener tablet like the Streak (480x800 mdpi).
  • 600: a 7" tablet (600x1024).
  • 720: a 10" tablet (720x1280, 800x1280, etc).
  • if you have a device don't support by one of these you can add another smallest screen width for that.

you can read more details here , here , here and this help you know your phone pixels per inch.

example:

you have a phone 1080*1920 pixel and 5" size.

  • first formula help you calculate pixel per inch (dpi).
  • second formula help you calculate Pixel ratio.
  • and last formula help you calculate dp.

this phone have 392 dp in width and smallest width for that is 320.

if you like use dpi Pixel ratio can help you.

  • ldpi => Pixel ratio = 0.75
  • mdpi => Pixel ratio = 1.0
  • hdpi => Pixel ratio = 1.5
  • xhdpi => Pixel ratio = 2
  • xxhdpi => Pixel ratio = 3
  • xxxhdpi => Pixel ratio = 4

这篇关于如何在 Android 中设计任何屏幕尺寸和密度(Android 中的手机多屏)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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