平板解析问题 [英] Tablet resolution issue

查看:137
本文介绍了平板解析问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个平板电脑摩托罗拉Xoom与 1280 * 800 我在我的绘制文件夹一张图片在我的项目,当我检查了该图像的显示大小 1280 * 755 但是当我在我的项目中使用此图像。

和调试它知道它的显示大小 853 * 503 ,显然它不适合入tablet.i附上了图片浏览也。

我用下面的code得到的宽度和高度。

  BitmapDrawable BD =(BitmapDrawable)this.getResources()getDrawable(R.drawable.fish_normal)。
INT高度= bd.getBitmap()的getHeight()。
。INT宽度= bd.getBitmap()的getWidth();


解决方案

我觉得你在华电国际文件夹中使用的图像。

//为华电国际

  853 *一百六十零分之二百四= 1279.5
503 *一百六十零分之二百四= 754.5

// 750 + 50剩下的50像素的底部栏

  1280 * 160 / 160-1280 //适用于mdpi

因此​​广义的资源规模(假设他们是全屏幕):

  LDPI
垂直= 426 *一百六十分之一百二十〇= 319.5px
水平= 320 *一百六十分之一百二十○= 240像素
MDPI
垂直= 470 *一百六十〇分之一百六十○= 470px
水平= 320 *一百六十〇分之一百六= 320像素
华电国际
垂直= 640 *一百六分之二百四十= 960像素
水平= 480 *一百六分之二百四= 720像素

I have a tablet motorola xoom with 1280*800 I have one image in my drawable folder in my project and when i checked the size of the that image its showing 1280*755 but when i used this image in my project.

And debugging it to know the size of it showing 853*503 and obviously it will not fit into the tablet.i have attached the picture here also.

I am getting the width and height by using following code.

BitmapDrawable bd=(BitmapDrawable)this.getResources().getDrawable(R.drawable.fish_normal);
int height=bd.getBitmap().getHeight();
int width=bd.getBitmap().getWidth();

解决方案

I think you are using images in hdpi folder.

//for hdpi

853 * 240 / 160 =1279.5 
503 * 240 / 160 = 754.5

// 750 + 50 remaining 50 px for bottom bar

1280 * 160/160-1280 //for mdpi

Therefore generalised size of your resources (assuming they are full screen):

ldpi
Vertical = 426 * 120 / 160 = 319.5px
Horizontal = 320 * 120 / 160 = 240px
mdpi
Vertical = 470 * 160 / 160 = 470px
Horizontal = 320 * 160 / 160 = 320px
hdpi
Vertical = 640 * 240 / 160 = 960px
Horizontal = 480 * 240 / 160 = 720px

这篇关于平板解析问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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