Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我想请教您一个关于fragment的重叠的问题。 #2

Open
Mran opened this issue Sep 24, 2016 · 1 comment
Open

我想请教您一个关于fragment的重叠的问题。 #2

Mran opened this issue Sep 24, 2016 · 1 comment

Comments

@Mran
Copy link

Mran commented Sep 24, 2016

我的app的结构是多个fragment页面平行的结构,用户的使用场景是会经常切换的,为了方便用户,我使用的是hide和show的方式来切换fragment页面的,而没有采用replace,但这会导致一个问题,就是在app长时间处于后台会被回收,再次打开后会导致fragment页面重叠。
我先阐述一下,我至今都做过那些尝试
尝试一:先判断是否是从内存恢复,是的话使用getfragmentbytag来重新获取之前的fragment,否则新建页面。网上有很多都是这样的方式,我使用了效果不好。
尝试二:使用http://www.jianshu.com/p/c12a98a36b2b这里的方法。短时间有用,长时间还是会出现重叠问题。
我的测试方法是在开发者选项里打开用户离开即销毁活动的方法。对于第二种方法,这样测试时是正常的,但是正常使用时还会时不时出现重叠。
我看到您在微博客户端里的做法是用replace,想请教您,您对于多fragment是怎么处理的。谢谢

@werbhelius
Copy link
Owner

有一点没懂你的问题...
平行界面的意思是在同一个布局下,通过切换显示不同的fragment么?
我项目使用的fragment是并列的关系。
replace有尝试过么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants