问题描述
我只是想以适应我的一些应用蜂窝。
问题II现在面临是我的活动对方向变化(横向/纵向)
的破坏在我使用的是经典的活动,我写在清单:
但现在,所有的这些行不工作了!
有没有一种解决方法是什么?
我的code:
<活动机器人:TwitterActivity名称=机器人:标签=@字符串/ APP_NAME
机器人:configChanges =keyboardHidden |定位/>
<活动机器人:名称=。TwitterActivity $ AppListFragment
机器人:configChanges =keyboardHidden |定位/>
根据我的经验与蜂窝3.0和兼容性库(R1)。
configChange =定向
确实工作与碎片相对于preventing正上方向变化重新创建的活动(其所应用)。如果你想在片段
不是要在活动的再创造再创造,然后调用 setRetainInstance
在的onCreate
。
除非我失去了一些东西我不太让你的第二个清单项,是不是 AppListFragment
A 片段
?如果是的话,为什么它列为你的清单中的条目?
请参阅这样,请回答以新的限定这很可能会导致这个,如果你正在打靶SDK 13,建议尝试安卓configChanges =方向|屏幕尺寸
I am just trying to adapt some of my applications for HoneyComb.
The issue iI am facing is the destruction of my activity on orientation change (landscape/portrait)
When I was using a classic activity, I wrote in the manifest:
But now, all these lines aren't working anymore!
Is there a workaround for that?
My code:
<activity android:name=".TwitterActivity" android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation" />
<activity android:name=".TwitterActivity$AppListFragment"
android:configChanges="keyboardHidden|orientation" />
Based on my experience with Honeycomb 3.0 and compatibility library (r1).
configChange="orientation"
does work with fragments with respect to preventing the activity (to which it is applied) being re-created on an orientation change. If you want the fragment
not to be re-created on activity re-creation then call setRetainInstance
in onCreate
.
Unless I'm missing something I don't quite get your second manifest entry, isn't AppListFragment
a Fragment
? If so then why is it listed as an entry in your manifest?
See SO Answer for new qualifiers which is likely to be causing this if you are targetting sdk 13, suggest trying android:configChanges="orientation|screenSize"
这篇关于机器人:configChanges =&QUOT;定向&QUOT;不与碎片的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!