Reputation: 13
I have a tabLayout with some fragments. I want to display one tabs view in sort of a fullscreen as an image (apart from the native phone statusbar) that covers the tabLayout. I want the image to completely overlap the tabLayout so the only way to get out of that view is to hit the phones backbutton. The attached images should help you get a better idea of what I am looking for.
Incorrect tab:
Correct tab:
The code I use to create the tabLayout:
https://gist.github.com/AndreiD/960c171c5c5137e95dde#file-android_view_pager
I tried a lot of xml editing but nothing works so far, the content is always displayed under the tabLayout (as shown in the incorrectTab). Does it have something to do with the usage of coordinatorlayout instead of a relative layout?
Upvotes: 1
Views: 440
Reputation:
You could try retrieving the tab layout from the fragment which you intend to cover the view with. Once doing this, try something along the lines of sliding mTabLayout.setVisibility(View.Gone)
Upvotes: 0
Reputation: 1122
Something along these lines may help out,
private ViewPager.OnPageChangeListener listener = new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
if (position == X) {
getActivity().getActionBar().hide();
}
else {
getActivity.getActionBar().show();
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
};
Upvotes: 2