gpt4 book ai didi

android - 使用 PNG 会降低 Android 应用程序的性能吗?

转载 作者:行者123 更新时间:2023-11-29 17:16:08 24 4
gpt4 key购买 nike

我目前正在 Android Studio 中开发一款 2D 游戏,我希望放置一个滚动背景。现在我在主要 Activity 之前将图像作为 Assets 加载为 png。一旦游戏开始,png 就会被重复绘制以产生运动的外观。我注意到在我的 Nexus 4 上,这会降低整个游戏的速度,从而大大降低游戏的性能。我只在另一部手机上试过这个,那是 Galaxy 6s。在 Galaxy 上,该应用程序没有遇到此类性能问题。所以我不确定这是否只是我手机的硬件问题。非常感谢任何关于如何提高我的应用程序性能的建议。

最佳答案

使用 PNG 不会降低性能,但会不断创建新的位图对象并将它们绘制到屏幕上。这个问题包含很多有用的信息:

How to draw lots of bitmaps on screen in an Android game without slow performance

还有这个:

https://gamedev.stackexchange.com/questions/8127/android-game-scrolling-background

关于android - 使用 PNG 会降低 Android 应用程序的性能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38863709/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com