与小部件和方向在国内应用问题 [英] Problem with widgets and orientation in home application

查看:91
本文介绍了与小部件和方向在国内应用问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个家庭的应用程序,我终于得到它承载部件。唯一的问题是,当我改变手机的小部件消失的方向,我必须重新添加所有。我知道,当方向变化,但我应该怎么办的小部件再次出现活动重现?

I am creating a home application and I finally got it to host widgets. The only problem is that when I change the orientation of the phone the widgets disappear and I have to add them all over again. I know that activities are recreated when the orientation changes but what should I do for the widgets to show up again?

推荐答案

设置背景一个活动的

请参阅我的答案在那里。只是不写在 onConfigurationChanged()方法什么。

See my answer there. Just do not write anything in the onConfigurationChanged() method.

这是造成的,因为在orintation变化重新启动您的活动。

This is caused because the orintation changes restarts your activity.

这篇关于与小部件和方向在国内应用问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆