简体   繁体   English

Android的背景图片大小

[英]Background image size for Android

I have an image that I want to place on the background on my activity. 我有一个图像,我想放在我活动的背景上。 For the G1 I would use a background of 320x480 but with the nexus 1 the resolution is almost double that. 对于G1我会使用320x480的背景但是nexus 1的分辨率几乎是其两倍。 Should I just place the large image and make the smaller phones size down? 我应该放置大图像并缩小手机尺寸吗? I am trying to keep the size of my package down as much as possible. 我试图尽可能地保持我的包的大小。

If it's a simple colour or a gradient, you can share the same drawable for all screen resolutions. 如果它是简单的颜色或渐变,您可以为所有屏幕分辨率共享相同的drawable。

If it's a more complex graphic, then you should create separate images for different screen resolutions (or densities) by placing them in the appropriate directories (eg "drawable-nodpi", "drawable-hdpi" etc.). 如果它是一个更复杂的图形,那么你应该通过将它们放在适当的目录中 (例如“drawable-nodpi”,“drawable-hdpi”等)为不同的屏幕分辨率(或密度)创建单独的图像。

A repeatable background image can be the best way to handle device resolution compatibility for simple patterns: 可重复的背景图像可以是处理简单模式的设备分辨率兼容性的最佳方法:

How to make android app's background image repeat 如何使Android应用程序的背景图像重复

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

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