Possible overdraw: Root element paints background @drawable/happy with a theme that also paints a background (inferred theme is @style/AppTheme)

安卓界面插入背景图片,当图片内存太大时,界面在切换时会加载失败,这是什么原因呢?这是设置android:background属性时发出的warning:

1 Possible overdraw: Root element paints background @drawable/happy with a theme that also paints a background (inferred theme is @style/AppTheme)

分析:安卓模拟器运行内存较小,如果页面加载的图片内存过大,切换页面时,原页面并没有关闭,而是以缓存的形式存在后台,等待用户随时唤醒,本页面加上要跳转的页面需要
占用的运行内存资源已经超过了模拟器的运行内存,就会提示页面加载失败。

解决方法: 1.将需要显示的图片处理下,使其分辨率降低
2.更换运行内存更大的模拟器或者安卓手机
3.想办法在页面切换的同时结束掉之前页面的进程

原文地址:https://www.cnblogs.com/zhncnblogs/p/6214680.html