Android 在不同分辨率下显示不同的图像

发布于 2024-09-24 21:18:19 字数 325 浏览 1 评论 0原文

我正在尝试创建一个图形密集型的 Android 应用程序。几乎所有的 UI 都基于位图,我希望支持尽可能多的不同设备,并让应用程序在所有设备上看起来都很棒。

是否可以为每个图像嵌入不同的分辨率并在每个设备上显示不同的图像。我知道像 hdpi 文件夹等东西,也有像倾角等单位,但这仍然留下太多关于图像显示方式的变量。我不想缩放图像以避免丢失图像质量。

例如,在我的高分辨率设备上,我希望图像精确为 100 像素,然后在中等分辨率设备上,我希望显示较低分辨率的图像,并且精确为 80 像素。如果我使用与显示无关的单位,我无法确保图像具有特定的尺寸。

有人对如何解决这个问题有任何想法或建议吗?

I am attempting to create a very graphically intensive android application. Almost all of the UI is based on bitmaps and I would like to support as many different devices as possible and to have the app look great in all of them.

Is it possible to embed different resolutions for each image and have a different image displayed on each device. I am aware of stuff like hdpi folders etc. as well has units like dip etc., but that still leaves too many variables as to how the image is displayed. I would like to not have the images scaled at all to avoid losing image quality.

For instance on my high resolution device I would like an image to be exactly 100px and then on a medium resolution device I would like a lower resolution image to display and be exactly 80px. If I use display independent units, I cannot ensure that the images will be of a particular size.

Anyone have any ideas or suggestions on how to go about this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妄想挽回 2024-10-01 21:18:19

结合使用 dpi(hdpi 等)和方向(陆地/端口),使资源在不同屏幕上尽可能定制。

此外,在 ImageView 中指定 android:scaleType="fitCenter" 或 android:scaleType="centerCrop" 以适应非标准分辨率。

Use a combination of dpi (hdpi etc) and orientation (land/port) to make the resources as customized as possible on different screens.

Additionally in your ImageView's specify android:scaleType="fitCenter" or android:scaleType="centerCrop" to accommodate non-standard resolutions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文