Reputation: 207
I have created navigation drawer in a separate class and extended that activity to a fragment. Navigation drawer is working fine in that fragment. And I am switching the content of the fragment using FragmentManager.
FragmentManager fragmentManager = getSupportFragmentManager();
if (savedInstanceState != null) {
if (savedInstanceState.containsKey("content")) {
String content = savedInstanceState.getString("content");
if (content.equals(FavoriteListFragment.ARG_ITEM_ID)) {
if (fragmentManager.findFragmentByTag(FavoriteListFragment.ARG_ITEM_ID) != null) {
setFragmentTitle(R.string.favorites);
contentFragment = fragmentManager
.findFragmentByTag(FavoriteListFragment.ARG_ITEM_ID);
}
}
}
if (fragmentManager.findFragmentByTag(ProductListFragment.ARG_ITEM_ID) != null) {
pdtListFragment = (ProductListFragment) fragmentManager
.findFragmentByTag(ProductListFragment.ARG_ITEM_ID);
contentFragment = pdtListFragment;
}
} else {
pdtListFragment = new ProductListFragment();
setFragmentTitle(R.string.app_name);
switchContent(pdtListFragment, ProductListFragment.ARG_ITEM_ID);
}
Navigation drawer is visible in ProductListFragment but on clicking FavoriteListFragment it is overlapped by that fragment. How to resolve that? I need to get the drawer in both ProductListFragment and FavoriteListFragment
Upvotes: 0
Views: 159
Reputation: 5598
I would suggest you to use MaterialDrawer library by Mike Penz. Simple and powerful API. Just browse the samples to examine the lib.
Upvotes: 1