更新时间:2023-01-23 21:07:23
在添加这些行您的清单
<activity android:name=".Activity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/app_name">
然后在你的java code此重写方法实施
then implement in your java code this override method
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);}
有了这个,你告诉你的应用程序时出现配置的变化做什么(方向的变化让我们说)我有同样的问题。整个活动重新启动,添加此,解决了这个问题。我希望它为你工作了。
With this you are telling your application to do nothing when config changes occur (orientation changes let's say) I had the same problem. The whole activity was restarted, adding this, solved this issue. I hope it does work for you too.