针对android系统中的多个屏幕尺寸...如何? [英] Targeting multiple screen sizes in android...How to?

查看:123
本文介绍了针对android系统中的多个屏幕尺寸...如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为针对所有的屏幕大小和像素密度(包括片剂7,9.1和10英寸)我的应用程序创建的布局。我有,我一直没能阅读文档后,理解好,即使几个疑问。目前,我已经做即四种布局的布局大,*的正常的*,,*的 -sw320dp 的*和 -sw480dp 。我感到困惑的图像密度。

我指的是Android提供了默认( ic_launcher.png 图像在绘制,华电国际绘制-LDPI 绘制-MDPI 绘制-xhdpi 绘制-xxhdpi )。我已经做了样品布局迈出了图像视图,并给予SRC为 ic_launcher.png 。但是,不显示任何设备或模拟器上这个形象。


  1. 请我需要指定不同大小的图像?如果是这样,在哪些文件夹?因为对于大屏幕的布局应采取更大的图像。

  2. 华电国际 LDPI MDPI 暗示类似大小的图像以不同密度或大小不同而已?
  3. 图片
  4. 此外,在布局屏幕较大的情况下,我应该参照绘图资源作为大尺寸图像(如果我采取小型,中型,大型图片),或将Android把它从绘制,华电国际


解决方案

您只需要把图像正确的文件夹:使用华电国际 + MDPI + xhdpi + xxhdpi

LDPI 仅在 1%的Andr​​oid设备,你不应该让他们。

您也可以为大屏幕创造不同的布局

读到这里获取更多信息

I am creating layouts for targeting my application for all screen sizes and densities (including tablets 7,9.1 and 10 inches). I have a few queries for which I haven't been able to understand well even though after reading the documentation. Currently, I have made four layouts namely layout-large,*normal*,small,*-sw320dp* and -sw480dp. I am confused about images densities.

I am referring to the image that android provides by default (ic_launcher.png under drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi and drawable-xxhdpi.) I have made a sample layout taken a image view and given src as ic_launcher.png. However, this image is not displayed on any device or emulator.

  1. Do I need to specify different sized images? If so, in which folders? Because layouts for larger screens should take larger images.
  2. Do hdpi, ldpi, and mdpi imply similar sized images with different density or images with different sizes only?
  3. Also in case of layout for larger screen, should I refer to drawables for large sized images (if I am taking small, medium, large images), or will Android take it from drawable-hdpi?

解决方案

You only need to put the images in the right folder: using hdpi + mdpi + xhdpi + xxhdpi

ldpi is only 1% of the android devices and you should not make them.

you also can create different layouts for larger screens

read here for more info

这篇关于针对android系统中的多个屏幕尺寸...如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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