简体   繁体   English

设计图片,按钮,文本等以适合横向模式下android平板电脑的所有屏幕尺寸

[英]Design images, buttons, text, etc to fit all screen sizes for android tablet in landscape mode

I am a bit confused about resolution of Android Tablets. 我对Android平板电脑的分辨率有些困惑。 Each Tablet has different resolution and size. 每个平板电脑都有不同的分辨率和大小。 How can I design images, logos, buttons, etc to fit all android Tablet size in Landscape mode. 如何在横向模式下设计图像,徽标,按钮等以适合所有Android平板电脑尺寸。

You need to make the images for only one size (or for one device). 您只需要为一种尺寸(或一种设备)制作图像。
Lets say you are working on a tablet with screen size 640x960. 假设您正在使用屏幕尺寸为640x960的平板电脑。
You can then make a layer of size 640x960 and add the images to that layer. 然后,您可以制作一个大小为640x960的图层,并将图像添加到该图层。
Once you have your layer with all the images you want on it, you must then scale that layer up or down depending on the device screen. 图层包含所有想要的图像后,您必须根据设备屏幕上下缩放该图层。

So if you made an image for a device with screen pixels: 640 x 960, and you test it on a different device with screen size 400 x 800, you would then scale the layer that contains your images like so: 因此,如果您为屏幕像素为640 x 960的设备制作了图像,并在屏幕尺寸为400 x 800的其他设备上进行了测试,则可以像这样缩放包含图像的图层:

layer->setScaleX(640/400);
layer->setScaleY(960/800);

And the layer will stretch inwards to fit the smaller screen. 图层将向内拉伸以适合较小的屏幕。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM