优化设计
您可以在目标设备上测试用户界面,以确保您的动画获得最佳性能。要解决性能问题,通常需要优化用户界面中使用的图形资产。
针对不同的目标设备优化用户界面:
- 尽量减小图片尺寸。
- 少用透明度。
更多信息,请参阅QML 性能考虑因素和建议。
最小化图像大小
图像是任何用户界面的重要组成部分。不幸的是,由于加载图片所需的时间、图片消耗的内存量以及图片的使用方式,图片也是问题的一大来源。
我们建议在不影响图像质量的前提下,尽可能缩小图像尺寸。
有关如何在用户界面中有效使用图片的更多信息,请参阅在用户界面中使用图片。
避免透明
不透明内容的绘制速度通常比透明内容快很多,因为后者需要混合,而且渲染器可以更好地优化不透明内容。
有一个透明像素的图像会被视为完全透明,即使它大部分是不透明的。具有透明边缘的Border Image 也是如此。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.