I've created SwipingTab with two Fragments. Now I want to add menu on bottom to be fixed, static. When user swipe between tabs, that menu should not moving. Where should I create that menu. I tried on main_layout.xml, but cannot. Any suggestion or idea ??
This is how I would set up the main view with tabs
Then the footermenu would inflate a fragment that will be used as a menu. You can follow this Android Tab Layout with Swipeable Views to add swapeable tabs
Related
I'm learning about tab layout because I need to use tab layout.
When i search for tab layout on Google, the one that comes up together is the view pager.
By the way, I'm not sure about the difference between tablayout and viewpager.
The tab layout has a menu at the top and screen switching is possible.
Although the view pager does not have tabs, it is possible to slide the screen just like the tab layout.
But why use the two together?
What's different?
Isn't it possible to slide in tab layout as well?
Yes, you can use TabLayout without viewPager. But without viewpager you won't be able to slide your page. You have to handle tabselect listener manually using this method then you have to click on the tab to navigate.
addOnTabSelectedListener(OnTabSelectedListener)
Likewise, you can use only Viewpager then you will be able to slide or swipe your page without any tabs.
From official doc
TabLayout
TabLayout provides a horizontal layout to display tabs.
Viewpager
Layout manager that allows the user to flip left and right through pages of data.
So Tablayout and viewpager are two different things but you can have the privilege of both tabs and slide only by combining them.
You can check here for tablaout without viewPager
TabLayout without using ViewPager
i have this interface in my app
by choosing each item in bottomNavigation , the tab layout will change
my question is should i make a fragment for each of the bottom navigation items and then put the tab layouts inside that fragments ?
or make only one tab layout in activity and change the adapter of the tab layout in respond to selection of the bottom navigation items ?
I have a screen with 2 different fragments ie dual pane view like tablets. I want to show different action menus for both the fragments in ToolBar.
I have inflated different menu.xml in onCreateOptionMenu method of each fragment with menu.clear. But on launch both fragments have same menu items.
I have defined ToolBar in each fragments layout xml.
Please let me know how both fragments will have different menus?
Thanks
I want to have a grid view menu or pop up menu that drop or slid with a button.not a Drawer layout.something like giddylizer app this:
giddylizer app image
is there any library?any helpful links and suggest...
As a suggestion , you can achieve that design easily by
Add frame layout into your main layout
Create two tabs with two fragments
Add grid-view into fragments
done.
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.