The old method of doing tabs by using actionBar.setNavigation() is crossed out and crahses on run. Android Studio seems to be suggesting that there is a new way to implement tabs. How!?! And will these new tabs follow the material design tabs?
You use SlidingTabs with view pagers, video found here: https://www.youtube.com/watch?v=tRg_eDfQ8fk&channel=androiddevelopers
Related
I am trying to make custom profile page , Tabbed layout is embed within ActionBar , and Tabs can change both with sliding and click on other tab.
I just started playing with ActionBar , and didn't understood what are major differences between Sherlock / simple ActionBar.
Here is what i am trying to make right now:
Any Help in any form appreciated , There is no similar Github lib or helper code at net/SO , so i can't figure out how i should get started
You will need to use a TabLayout along with a ViewPager. These are standard controls. Google it or see here for an example of how to use it. ActionBarSherlock isn't used anymore. Instead we use a Toolbar.
I have been doing a small research on UI designs for Android for the last few weeks. My main concern right now is the action bar along with tabs. I believe the default android implementation takes to much room on the screen.
Recently I took a look at the Flickr app and I really like how they do this but I am not sure how to implement tabs this smoothly inside the action bar itself.
All help / ideas are appreciated.
Thanks in advance.
Screenshot of the action bar can be found here:
https://dl.dropboxusercontent.com/u/242865/Screenshot_2014-11-11-11-04-05.png
Check out this library on github.
It's an Android Library to help you create actionbar tabs like Capitaine train app by Cyril Mottier.
You have to set a customview in your actionbar and use something like ViewPagerIndicator
http://viewpagerindicator.com/
To setup a custom view in your actionbar just use setCustomView but remember to enable the display of custom view first.
Take a look at this
http://www.jfarrell.net/2013/10/customizing-action-bar-in-android.html
Any idea how to implement tabs like these (the one on top with home image, star, etc)
Using tabs in an action bar on Ice Cream Sandwich.
Or ActionBarSherlock tabs for a full on backward compatibility.
Those are so-called "swipey tabs", probably on top of a ViewPager. ViewPagerIndicator has an implementation of such tabs.
if you wish to use the same tabs-pager like on the android market app (aka google play) , you can get the android support library from the sdk manager and see their sample on ".../extras/android/support/samples/Support4Demos" .
there , find the fragment example called "tabs and pager" . i think you will like it ... :)
Try this. The solution there is to use the setDividerDrawable(...) method of the TabWidget class. Then you can define the looks of the tabs with XML.
I am creating an app where i would like to use both the drop down list navigation and tab navigation on an actionbar. But i can not figure out how to do this without implementing the actionbar as a custom view which would mess up a lot of the nice built in features.
So what is the best way to get both of these navigation modes at the same time?
Android will not build both of these for you. You can use the ViewPagerIndicator library to make an emulated tab bar for a ViewPager, which is probably the easiest way to do this.
As in this image:
![two muppets][1]
where the buttons are Main, Favorites, and Help.
This is obviously a Tab Layout. Read Google's documentation and this more clear example
check this:
http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
That is not the Button. It's Tab Bar that is Displayed at the Top instead of Bottom
Tab Bar aligned Top
I would recommend that you look at the Android Tab layout tutorial: http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
HOWEVER please be aware that this tutorial uses the TabActivity class, which is deprecated. The documentation for TabActivity contains a version done using Fragments, which is the way tabs should be done now: http://developer.android.com/reference/android/app/TabActivity.html
Note that if you are developing for older Android devices, you should download the v4 support library, which allows you to use Fragments on old API versions: http://developer.android.com/sdk/compatibility-library.html