Fragments overlapping? #23
Comments
Actually Fragments is stored inside your Sections, that is stored in if(fragment instanceof android.app.Fragment)
getFragmentManager().beginTransaction().replace(R.id.frame_container, (android.app.Fragment)fragment).commit();
else if(fragment instanceof android.support.v4.app.Fragment)
getSupportFragmentManager().beginTransaction().replace(R.id.frame_container,(android.support.v4.app.Fragment) fragment).commit(); Maybe the problem is that I always replace fragments but I don't remove it. |
Mmm.. so.. if you replace your FragmentIndex with 3 different fragments with different layouts and content, you don't see any overlapping happening? this.addSection(this.newSection("Overview",this.getResources().getDrawable(R.drawable.ic_search),new FragmentIndex())); this.addSection(this.newSection("Stocks",this.getResources().getDrawable(R.drawable.ic_search),new FragmentIndex())); I have taken a couple of screenshots: I would appreciate any help you could give. |
I created a sample project that use three fragments with different layout, but my fragments won't overlap each other. |
I have the same problem. It doesn't matter if you replace the fragment with addSection() or just with getFragmentManager().beginTransaction().replace(). It always overlaps the fragments. Note: My fragments ARE transparent |
I have just committed a possibly fix. |
I did not work but I know now how to reproduce the bug. Change your
instead of
(I guess you HAVE to use support fragments when using the library) |
I have created three fragments that have three different objects in different spaces of the screen. |
I did some more research. It turns out you need 1 fragment importing support fragment, and another importing the normal one. So different ones for each fragment.
And yes the APK worked fine on my device running 5.0.1 It kind of makes sense that replace doesn't work like that. So it's not really your fault, just our fault using 2 different kinds of fragments. |
ok, I'll add a RuntimeException if the section support another type of fragment, I'll release a new version tomorrow. |
hi guys sorry just home now. Actually, my project is using a v4 fragment (my custom one) and fragmentindex which extends the normal fragment, so it would make sense that @montanax deduction is correct. I will do a couple more tests now and will let you know later. I am available to send you some of my code if it will be needed. N |
yep, confirmed, changing the fragmentindex to a v4 as well (so having them all v4) works fine. |
hahaha il mondo e' piccolo! |
Hello again,
I implemented your library mostly successfully (thanks, you are doing a great job btw) but when I replace the FragmentIndex of your example with 3 different fragments, what I see is that the fragments overlap? So I can still see fragment1 when I should only see fragment2. You don't see that in your example code because your fragments are all instances of FragmentIndex, so they are identical.
In your implementation, are the fragments added, or are they replacing previous fragments?
thanks for the clarification!
The text was updated successfully, but these errors were encountered: