简体   繁体   English

具有不同图像和字体大小的不同设备

[英]different devices with different image and font size

I am creating an app for different devices and I added images with different sizes in drawable-small, drawable-medium... to add the same image for different devices but I need to increase the size of the image when the size of the screen increases is this the correct way? 我正在为不同的设备创建一个应用程序,并在drawable-small,drawable-medium中添加了具有不同尺寸的图像...以为不同的设备添加相同的图像,但是当屏幕尺寸增大时,我需要增加图像的尺寸增加是正确的方法吗? plus I need to increase the font size when the screen size increases how can I do that and if I used the layout-small... folders what font size will be the perfect size for the devices with small screen size (portrait and landscape) and for the medium and large..?where can I find this info as I am trying and trying different font sizes but there must be another way!! 另外,当屏幕尺寸增加时,我需要增加字体大小,并且如果我使用的是layout-small ...文件夹,那么哪种字体大小对于屏幕尺寸较小(纵向和横向)的设备来说将是理想的大小。对于中型和大型..?在尝试不同的字体大小时,在哪里可以找到此信息,但是必须有另一种方法! thanks. 谢谢。

This is a very rookie question but here goes: 这是一个非常新手的问题,但是这里有:

You set the text and image sized in dp (density pixels) so screen size and resolution is irrelevant. 您以dp(密度像素)设置文本和图像的大小,因此屏幕大小和分辨率无关紧要。

As for making multiple drawables for each screen size is a good idea but not a necessity since you can choose how much of the screen each picture will take, but on bigger screens make sure the resolution of your images are high enough to look good. 至于为每个屏幕尺寸制作多个可绘制对象是一个好主意,但不是必须的,因为您可以选择每张图片将要拍摄的屏幕数量,但是在较大的屏幕上,请确保图像的分辨率足够高以看起来不错。

For scaling a particular image to all screen size you can use nine patch image. 要将特定图像缩放到所有屏幕尺寸,可以使用九个补丁图像。 There will be drawninepatch.bat file in the tools folder of your sdk. sdk的tools文件夹中将有drawinepatch.bat文件。 Open that , drag and drop the image , and you want to expand the image based on your needs. 打开该窗口,将其拖放到图像中,然后您就可以根据需要扩展图像。 Now after the nine patch is created put that in the drawable folder. 现在,在创建了九个补丁之后,将其放入可绘制文件夹中。 This image will expand accordingto the screen resolution and densities. 该图像将根据屏幕分辨率和密度进行扩展。

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

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