How would I go about implementing swipeable icon tabs as the main navigation in an app? Heres a screenie of the popular Flipboard app, which demonstrates what im looking for: http://prntscr.com/83607c
I have been looking for an answer to this question for almost a week now, and have asked on several communites yet no one seems to be able to answer how to go about doing something like this. I'm assuming its a ViewPager for the swipeable part, but the only thing I can think of for the tabs would be a TabLayout, but this implements tabs "below" the toolbar, eg: http://prntscr.com/83674c which is not what i'm looking for.
Google recently released Support Design library. Witch contains all the necessary views. You can read more here
The views you are interested:
TabLayout and
TabLayouts.Tab
Related
I have made my navigation drawer and it is working all fine , it is according to new design rules. but now I have a problem and after a couple of search I have found no note over it so far. So I end up with asking question here.
What I have done so far is some thing like
the picture shows you the demo , How ever I have made some thing like this its just the demo to give you people hint about what is header in the navigation drawer and where my menu items list lies
You can clearly see that there is a header in the navigation drawer and the menu item list beneath it .
Problem 1
now do to some reasons I have deleted the header , but my menu Items goes upwards to the top starting point. I know I can give margin up , but this is not the good way
Is there any good way I can just centralized them vertically ? I am wondering How to do it , Please Help me .
and Problem 2 is , I want to minimize the distance and margin between the menu items and menu icons in navigation drawer How to do this. I have not seen any of the discussion over it.
Please help me in solving both problems.
On screenshot you attached to your question, the navigation drawer doesn't look fine and according to the new desing rules :-/
Just have a look at the official guide: https://www.google.com/design/spec/patterns/navigation-drawer.html
Luckly for you nowdays we are provided by Google with Android Design Support Library that helps us with creating Navigation View (that replaces Navigation Drawer)
Here are links for you:
official documentation, always a good read: https://developer.android.com/reference/android/support/design/widget/NavigationView.html
nicely written blog post about Navigation View: http://antonioleiva.com/navigation-view/
and last but not least, sample app using new Android Design Library: https://github.com/antoniolg/MaterializeYourApp
I know it's not the answer you were looking for, like "just change true to false in the line number 10" but stay assured that using official Navigation View is a way to go in modern Android world.
You can use the new NavigationView from the Android Design Support Library in making your navigation drawer. NavigationView make s creating material design-compliant navigation drawer.
You can read about it at http://android-developers.blogspot.com/2015/05/android-design-support-library.html
Read these three articles
Take a look at this code
Use the design support library
I have been familiar with TabHost/TabSpec to create application with tabs. I noticed that there are more than one option to create tabs:
1- Tabs in action bar
2- Viewpager (I guess google calls it horizontal pager)
3- And offcourse the tabhost/tabspec approach.
I tried to read google docs but it is like everywhere so I got further confused.
When would you use what or is there one that is the norm?
Thanks
You should use a Toolbar with a ViewPager to simulate tabs (all wrapped in an AppBarLayout). The result will look something like this:
You can read more about this type of design on the Material Design spec: https://www.google.com/design/spec/components/tabs.html#tabs-usage
Also, here is a good tutorial on how to implement tabs within a ViewPager: http://blog.grafixartist.com/material-design-tabs-with-android-design-support-library/
Im trying to implement a tabbed navigation where the tabs are located inside the Toolbar and the user can navigate via left/right swipes or tab clicks, just like the Hotel Tonight app:
Screenie:
http://i.imgur.com/joXRr1N.png
Before this would be done using ActionBar.Tab, but that has been deprecated. All tutorials and SO questions i've found have only described how to use the new TabLayout to put tabs under the ToolBar, not inside it. How should I go about implementing this? What would the basic xml layout look like?
You can try using PagerSlidingTabStrip and here you are a tutorial:
https://guides.codepath.com/android/Sliding-Tabs-with-PagerSlidingTabStrip
I don't think these examples use viewpager, but visually they look a little like viewpager.
See Evernote's settings:
http://1.androidauthority.com/wp-content/uploads/howto/evernote-screenshots-120524.jpg
And Pocket Casts' handheld control pane:
http://www.shiftyjelly.com/android/pocketcasts
Basically, a panel is swiped in from left, but the left edge of the previous panel is still visible.
So my question is, is this UI pattern featured in an example you have seen, or did these two make it out of whole cloth and now I have to, too?
Edit for posterity:
As of Google I/O 2013, this is now built into Android. They call it the Navigation Drawer: http://developer.android.com/training/implementing-navigation/nav-drawer.html
https://github.com/jfeinstein10/SlidingMenu
This library might help you out. I think this is what you're trying to achieve.
EDIT
I've updated the link to another SlidingMenu library but as of 2015/09/16, I wouldn't use the library referenced here anyway. Google has provided the DrawerLayout in the v4 support library to achieve this. Inside the drawer, for a more standard structured navigation, the design support library has also provided the NavigationView that can be placed inside the DrawerLayout and use standard menu resource to inflate the items contained within. This SO can help out with the details of the implementation.
I just encountered a problem in layout design with tabhost.
i need exactly the same design so that on selecting a tab it will come in cented of the screen. with design like in these pictures.
Currently ViewPagerIndicator is the best resource for getting this done without too much code. As for the same design you're going to have to do a little work yourself to get that done. If you look through the samples on the projects github you'll see some examples of how the ViewPagerIndicator can be themed.
http://viewpagerindicator.com/