Is it possible to make tabs in ActionBar look like scrolling tabs, e.g.:
Because all I can get are fixed tabs like:
What you're trying to achieve are not scrolling tabs, but a ViewPager. You won't be able to get the look you want using only tabs.
Take a look at the good tutorial here on the ViewPager: http://android-developers.blogspot.co.uk/2011/08/horizontal-view-swiping-with-viewpager.html
The best way to implement this is to use Fragments, and the library ViewPageIndicator for the top list of pages.
Please check: http://developer.android.com/training/implementing-navigation/lateral.html#swipe-tabs
Related
I want to design a layout similar to the images where user selects one item in each step (drink,sauce...) user advances next step (and its displayed in stepper). user can also swipe(in red area) or click one of "1,2,3,4,5" pages to change page.
I searched how to do it with recyclerview but couldn't find a solution. What layout do i need to use for such case. just need to know how to achieve similar designs. I don't need code or xml for solution just an explanation will be enough.
Thanks for helping.
You should use TabLayout and ViewPager. You have to add TabLayout and ViewPager. Than, your TabLayout should have different TabLayout inside of that ViewPager.
I've implemented nested tabs with view pager with no problems, but my problem is on the swiping part,
When I do the swiping action the main activity tabs will be switched, but I want the fragment to swipe instead. how can I achieve this?
I've tried implement main tab with tab host and fragment tabhost which doesn't have swiping feature at all, but that disabled whole swipe on the main and fragment together.
Instead of custom library you can try to use Bottom navigation view for bottom bar which has been added to version 25 of the Design Support Library. Here is an Article about it.
So android.support.design.widget.BottomNavigationViewin your activity together with android.support.design.widget.TabLayout and ViewPagerin fragment should work the way you want it to work. And this will also provide good UX (similar to one implemented in Google Plus App)
hello shaheen zahedi maybe it's possible please..with..below
just set bottom tab changed listener
like..
btnTab.setTabChangeListener(null);
You can disable view pager swiping on a particular ViewPager.
But I would suggest to not make 2 ViewPagers on the same screen.
Your bottom TabLayout and corresponding ViewPager can be replaced with BottomBar library.
I feel like it is wise to follow the Google Material guidelines. Not sure if you checked it out already...
Either way, here is what Google considers best practice for lateral navigation between tabs. Hope it helps!
I made a sample project with nested tab and fragment. may be it might help what is you looking for.
following link to download:
NestedTabWithFragment
I have seen a great design in one app.
There is custom tabs representation and animation.
If the tabs doesn't has next(the last tab) there are only two tabs on the screen current at the center and adjacent.
And there is custom animation when switchng between tabs.
How to implement similiar tabs view and custom animation.
I will be grateful everyone for help.
You should take a look at this beautiful library: https://github.com/jpardogo/PagerSlidingTabStrip. It's exactly the same what you want I think. If you want to add some beatiful transition animations between the fragments, you can check this: https://github.com/jfeinstein10/JazzyViewPager
I would like to achieve a navigation in my app like Pinterest or Trello, that is, kind of three tabs to navigation + horizontal scrolling.
I have made a custom tabbar for this (since I couldn't guess how to change tabs width in my actionbar with navigation TAB mode). So I have three buttons to navigate from one fragment to another. Now I would like to implement the horizontal scrolling like these two examples, to also navigate among my fragments.
I have read about View Pager but I don't know if it fits to my case, since I don't have only views but fragments. Does anybody have an example or an idea of how to do it? Could I apply it among different activities?
Thanks
Please take a look at the duplicate question that I just answered:
How to implement a swipe-gesture between Fragments?
I suppose the Android ViewPager is what you are looking for:
http://developer.android.com/reference/android/support/v4/view/ViewPager.html
Here is a nice tutorial on how to implement it:
http://developer.android.com/training/animation/screen-slide.html
The basic idea is that you have multiple Fragments, each representing
a different Screen. The ViewPager enables the user to swipe between
the different Fragments and display different content.
You can use ViewPager. More information about viewpager this.
I am concern about the ViewPager or ViewFlipper. I don't want to use ViewPage. So I want to know how to swipe between Layout or activity. Can anyone suggest me with source code. Thanks in advance.
I cannot understand why you don't want to use ViewPager. You'll be able to swipe between everything you want(activity, layout). It's not difficult to use it and to customize it. There is a plenty of examples:
Fragments
General
you can easily surf through the i-net to look for more examples