I'll give a brief description of my app layout. There is an Activity, inside it is a FrameLayout wrapped with a RelativeLayout (there are some other widgets too inside this Relative Layout), whose dimensions are set to 'Match Parent'. Inside the MainActivity, I do a fragment transaction, replacing that FrameLayout with a Fragment.
The one thing common between the Activity and Fragment is that they both have a Tab Menu at top. Now, when the Fragment replaces the FrameLayout, the Tab Menu of the Fragment is supposed to replace that of the Activity (FrameLayout is set to Match Parent dimensions). However, this does not happen.
Only the RecyclerView in the Fragment shows above the RecyclerView of the Activity (I have one Recycler View each in the Activity and Fragment). The Tab Menu stays the same as that of the Activity.
This is very perplexing. Am I missing something?
When moving from activity to Fragment,You need to set View.Gone
on activity's views to achieve the desired view.
You can remove activity views like that.
In Activity, Before making Fragment Transaction,
//whatever view you want to remove//.setVisibility(View.GONE)
When coming back from fragment to Activity, you should set View's Visibility back to visible.