太多碎片导致OutOfMemory错误

时间:2016-09-18 00:56:56

标签: android performance android-fragments android-viewpager

我正在制作一款在其MainActivity上使用底部导航栏(BottomBar)的应用。 FrameLayout位于BottomBar上方。每次单击底栏中的图标时,使用FragmentTransaction的replace()函数将选项卡的片段插入到FrameLayout中。插入的片段包含ViewPager,这会导致更多的片段启动和缓存。现在,只有一个活动,但有很多碎片。我没有加载任何数据,即使将maxHeapSize设置为4gb,我也已收到OutOfMemory异常。

如何在不更改UI的情况下提高性能(仍然有一个底部导航栏,每个标签包含一个viewpager)?

0 个答案:

没有答案