Navigation bar and viewpager on same activity - android

In my app navigation drawer and viewpager are on same activity. I want to hide viewpager on clicking the item on navigation drawer.
I tried to set its visibility as GONE but it didn't work.
Pleaseeee tell me how to hide it thanks..
Tab.setVisibility(ViewPager.GONE); this is the line I wrote in my code
On clicking drawer item fragment containing webview opens

If you want to hide the ViewPager, you need to set it's visibility to View.GONE. Try
myViewPager.setVisibility(View.GONE);
instead. Currently you're setting the visibility on a Tab and not the ViewPager itself. They're 2 completely different things.

Related

How to set toolbar.setNavigationOnClickListener only for current fragment?

Started new project from navigation drawer activity template. By default, all drawer menu items are at the same navigation level. All fragments display hamburger menu button, that shows drawer.
I need to keep all items in drawer, but place Home as top level item and others as it's children like this:
Tried to overwrite toolbar?.setNavigationOnClickListener { } in Gallery fragment, but it also affects Home fragment and I didn't find how to restore default behavior.
How can I set Home as navigation parent for others or how to set navigation click listener to only one fragment?
For example you have set tag for every fragment to trace when you start new fragment and now check with Home and set click event..
Fragment home = getSupportFragmentManager().findFragmentByTag("home");

how to disappear `BottomNavigationView` in some fragments?

I have a BottomNavigationBar in the MainActivity. I want to hide it in the some fragments.I saw this question but its solutions didn't work for me.How to hide bottom navigation bar in specific fragment?
I have three items with the following names.MainPageFragment and ListQuestionFragment and ListAnswerQuestion.ListQuestionFragment and ListAnswerQuestion contain the list of items and when User click every item a new fragment will be replaced.These fragments are the details of those item. I want to hide BottomNavigationBar in these fragments.

Swipe tabs inside one specific fragment

Inside my app I am using navigation drawer for my navigation. For each "page" I am using fragments (like showed here: http://developer.android.com/training/implementing-navigation/nav-drawer.html). It works completely fine, but now I want to create swipe tabs. I want to display those tabs only on one of the fragments. Problem is, that tabs are displayed on all fragments, which is ofcourse perfectly normal because tabs are inside action bar. What should I do, to display tabs only on one fragment?
From what I have understood, you are interested in showing action bar only in a particular fragment (not visible when swiping in subsequent fragments). The best way would be to code the action bar in fragment instead of using the action bar in main fragment and then creating swipe views (or sub fragments).
Hope it helps.

Navigation Drawer disable backview when drawer open

I am getting a strage behaviour with my navigation drawer. I use a custom layout for it, containing not only the usual listview!
Whenever i click somehwere in the drawer section the rows from the behind listview are getting clicked. How can i disable that?
SOLUTION:
just set android:clickable="true" on the parent layout in the drawer outside the listview and it all works fine.
Thanks for your answers.
Try this in your MainAcivty with the drawer content when it's open, to disable sending touch events to parent layout
getParent().requestDisallowInterceptTouchEvent(true);
Set android:clickable="true" to the parent layout in the drawer section.

Hide tabs in viewpager

I am using Actionbarshelock library. I have three tabs. each tab contains a fragment. In my middle tab I have sliding drawer. I want to hide action bar as well as tabs from screen so that i can gain more space for sliding drawer. I hide the action bar using `hide' method but don't know how to hide the tabs and show only that middle fragment in whole screen with sliding drawer open.
I have tried
requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_ACTION_BAR_OVERLAY);
It hides tabs but it has to be set before adding fragments and setContentView.

Categories

Resources