Change background color has no effect once screen has been rotated

拥有回忆 提交于 2019-12-04 21:50:24

Android will recreate the whole activity when you rotate the screen - so probably your variable "mScreen" won't point to the instance actually visible on the screen after rotation.

You can avoid, that android recreates the activity as explained here: http://developer.android.com/guide/topics/resources/runtime-changes.html

One solution would be to lock the screen so it can't be rotated? (Or at least lock it during this functionality.)

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!