如何在活动主题/样式中使用背景图片?Android活动背景图片
如果我做到这一点使用颜色:
<style name="CustomTheme" parent="android:Theme.Light">
<item name="android:windowBackground">@color/custom_theme_color</item>
</style>
它工作正常,但如果我更换行:
<item name="android:windowBackground">@drawable/splash_image</item>
的图像显示正确,但所有的内容被压扁成屏幕左上角的一个小块。状态栏下方的阴影也被切断或混乱。
我使用的是Android版Mono,图像是一个有效的九贴片PNG。
对于大家阅读这里...请注意,您在windowBackground中使用的drawable作为定制的AppTheme将被加载完全解码到您的堆中。由于在运行时完成了解码,即使是小尺寸的图像(如90KiB)也可能导致90MiB以上的分配。这会导致OutOfMemory问题比光线更快。 :) – JacksOnF1re
有关其他信息,请阅读此文章如何正确设置启动画面:https://www.bignerdranch.com/blog/splash-screens-the-right-way/ – JacksOnF1re