How to integrate tabs inside a layout? - android

I would like to use the component tabs Android but within a layout. In fact, I would like the tabs is not sticking to my action bar in order to display information between.
Here is an example image of what I would get:

You can add tabs inside a FragmentTabHost
Here is a tutorial implementing this
http://www.betteropts.com/fragmenttabhost-tutorial-using-fragment-as-tab-content-and-keep-navigation-history-for-each-tab/

Related

Tabbar in ios at the top of screen

I want to make tabbar at the top of the screen in iOS and want to place 3-4 tabs. Android is giving functionality by default using Tab bar layout. For more understanding https://www.truiton.com/2015/06/android-tabs-example-fragments-viewpager/
Thank you for your help.
You can achieve it by using UICollectionView inside your ViewController. Create a custom tab bar on your ViewController and set actions for each bar to navigate the pages on your UICollectionView.
You can manipulate your Custom UICollectionViewCell inside cellForItemAt to differentiate each page.
For UICollectionView tutorial you can check out this page: https://www.raywenderlich.com/9334-uicollectionview-tutorial-getting-started
I have created a view pager with a bottom tab bar, like instagram has, on one of my apps using this UICollectionView.

View Pager tabs in middle of fragment

How do i implement these tabs, the same as in Google plus profile page?
I think I can't use ActionBar tabs as they are clinged to ActionBar. I want the tabs to be below an image like in this image. Also i want these tabs to be fixed. I want three tabs and all three tabs should be visible on screen - as the android fixed tabs plus swipe layout which uses Action Bar tabs though.
Have a look at Jake Wharton's excellent Android ViewPagerIndicator library.
This sample gives you what you are after.
i have been looking for something like that, but the closest solution i have found is this:
Google+ profile like scrolling Effect
Hope it helps.

Moving the ActionBarTabs

I've set up a ViewPager in my App with tabs, but I need to position the tabs underneath a button so the layout would be
TitleBar
Button to search activities on a day
Tabs of each day there are activities
Is that kind of layout possible to do using Tabs or will I need a different approach to solve this?
The way the activity is running is theres a main activity, and the layout is just the button and a FrameLayout, and the the list (where the ViewPager is) is set up in a fragment and the fragment is loaded into the FrameLayout. I don't know if this is the best method for this so if not please add your recommendations of a better method I could use.
EDIT: If I could get it so all the tabs were at the bottom of the screen this would also be fine.
Is that kind of layout possible to do using Tabs
Not with action bar tabs. Not only can you not control where the tabs go, you cannot even control if there will be tabs versus a drop-down list.
will I need a different approach to solve this?
You are welcome to use some other tab solution (ViewPager with a tabbed indicator, FragmentTabHost, etc.) where you have more control.
Note that your proposed design does not adhere to Android design aesthetics. Most apps would not have "Button to search activities on a day", but instead a search action bar item, or perhaps a SearchView in the action bar.
If I could get it so all the tabs were at the bottom of the screen this would also be fine.
This is completely against the Android design guidelines. Don't use bottom tab bars on Android.

Android sherlock actionbar tabs alignment

I'm using Android sherlock fragment tabs for creating a layout for swiping the tabs.
Now what I want to do is put the tabs below a relative layout , but the tabs headers are appearing at the top while it's content is appearing where it should be.
You may use standalone tabs widget like https://github.com/JakeWharton/Android-ViewPagerIndicator
or move existing tabs using technique (really hack) described at http://kriomant.blogspot.ru/2013/08/navigation-drawer-tabs-overlap.html
But in case of hack current tab indicator will still be drawn at the bottom. I didn't investigate whether it is possible to move it.

How can I add tabs to a view outside the action bar?

I have a layout where I need tabs inside a sub-layout, not in the action bar. I.e., The tabs do not apply to the entire screen display, only to one of the panes.
How can I do this in Android 4.0+?
You can do this using the support library and a FragmentTabHost. Google has an example here. In your layout file you can embed the android.support.v4.app.FragmentTabHost that's shown in the example inside another layout, such as a pane.
Another option is to use scrollable tabs. They also can be imbedded anywhere in a layout. Google gives a code example here. The view that you will imbed in your pane is the android.support.v4.view.ViewPager with a android.support.v4.view.PagerTitleStrip as it's subview. This example also has a sample project that you can download (the example project doesn't have the scrollable tabs imbedded inside another layout, but it's a good starting point).

Categories

Resources