I originally posted this queston on coderanch, but I didn’t get responses, so I am trying my luck here.
I am trying to replace fragment1 with fragment3 by clicking on a ‘Change Fragment’ Button defined in fragmen2. Fragment3 will not fully replace Fragment1 completely. Instead it lines itself up underneath the text in Fragment1. I am doing something silly and I could use some pointers. I have included the code here and the output error screenshot (the gray area fragment3 doesn’t completely overlay the white area fragment1). Thanks for any pointers.
I tried to upload and format all the code here, but for some reason, it tells me my code is not indented with 4 spaces and my output image is not a jpeg image. So I got the code posted at
http://www.coderanch.com/t/556305/Android/Mobile/Dynamically-replacing-Fragments
Sorry I couldn’t post it here.
On my output, I see that fragment3.xml doesn’t completely overlap fragment1.xml. Any help would be sincerely appreciated. Thanks
You should not use
R.id.fragment1. You should give an Id for theFrameLayoutandreplacethe contents of theFrameLayoutwith fragment2.