简体   繁体   English

如何提供完整的Android屏幕分辨率的位图?

[英]How can I provide Bitmaps for the full Android screen resolution?

Simple question actually and I have spent hours searching for an answer. 实际上是一个简单的问题,我花了数小时来寻找答案。

What is the best way to provide bitmap resources that fill the full screen? 提供填满整个屏幕的位图资源的最佳方法是什么? For instance for a full app background or something. 例如完整的应用背景或其他内容。

Currently I place all my images in drawable-nodpi in a medium resolution and obviously need a lot of custom scaling. 目前,我以中等分辨率将所有图像放置在drawable-nodpi中,显然需要大量自定义缩放。 I do need images the fill the full, or the half or a third of the screen width. 我确实需要图像填充整个屏幕宽度或屏幕宽度的一半或三分之一。 What is the best way? 什么是最好的方法?

Michael Ellen states ( https://stackoverflow.com/a/6938345/1162415 ) that eg drawable-ldpi has 240 px screen width. 迈克尔·艾伦(Michael Ellen)( https://stackoverflow.com/a/6938345/1162415 )指出,例如drawable-ldpi具有240像素的屏幕宽度。 While I would love this to be true I do not think so. 虽然我希望这是真的,但我不这么认为。 Table 3 at http://developer.android.com/guide/practices/screens_support.html#testing clearly says that ldpi might result in actual px resoluation width of 240, 480 or 600. http://developer.android.com/guide/practices/screens_support.html#testing上的表3清楚地表明,ldpi可能导致px分辨率的实际宽度为240、480或600。

Should I build the app with drawable-*dpi fixed for screen sizes, something like drawable-ldpi-small and so on? 我是否应该使用针对屏幕尺寸固定的drawable- * dpi构建应用程序,例如drawable-ldpi-small等? We do make use of 78 cards ( https://play.google.com/store/apps/details?id=com.pinkwerther.tarot if you are interested) which should be displayed almost full screen. 我们确实使用了78张卡片(如果您有兴趣的话,请https://play.google.com/store/apps/details?id=com.pinkwerther.tarot )应该几乎全屏显示。 That makes a hell of an overall app size. 这使整个应用程序规模变得难以承受。 Either that or a hell of a lot of different apk files. 要么,要么是很多不同的apk文件的地狱。

Now there is one solution I am currently thinking of that might be suitable. 现在有一种解决方案,我目前正在考虑这可能是合适的。 Namely to provide kind of low resolution default images and have the apk with an expansion file ( http://developer.android.com/guide/google/play/expansion-files.html ) of really high resolution images which get scaled and stored on first use. 即提供一种低分辨率的默认图像,并为apk提供一个真正高分辨率的扩展文件( http://developer.android.com/guide/google/play/expansion-files.html ),该文件可以缩放并存储首次使用。 Before I dive into this possibility I just want to make sure there is no simpler solution... So please feel free to hint me to the hidden places I happen not to be aware of! 在我探讨这种可能性之前,我只想确保没有更简单的解决方案...因此,请随时向我提示那些我可能不知道的隐藏地方!

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

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