Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 TabActivity 有一个烦人的问题。我有几个活动,当我在它们之间切换时,每个活动都会重新创建并丢失所有信息:(
我试过使用android:launchMode="singleTop"但没有运气:(
android:launchMode="singleTop"
有什么线索吗?
这是一个示例项目,显示了选项卡中活动的使用,它不受您引用的问题的影响。
更好的办法是摆脱活动,只使用视图作为选项卡的内容,因为这样可以节省 RAM、CPU 和电池寿命。有关示例,请参阅此项目。