Android : ViewFlipper Or ViewPager - Which is the better option? - android

I am getting stuck in one stage. I have a total of 20 to 25 images that should get animated like ViewPager does. Now on all the images I have onClick() events and I don't know if I should work with ViewPager or ViewFlipper. I can implement both things, no issues here.
What I Want : I just want a suggestion that according to my problem which will be the best option, ViewFlipper or ViewPager?
What I Have Searched : I have gone through different links on StackOverflow, namely How to improve the performance of ViewFlipper/ViewAnimator and ViewFlipper vs Fragments, but I could not find the thing I want.
I have worked with ViewPager somewhat, but at that time there were just 3 or 4 Fragments I had to manage. If I were to use it to solve this problem I have to manage 25 Fragments this time. So I am wondering if there is a better solution available.
I have also done a little R & D on ViewFliper and know that it has only one Activity I have to manage but it does not have the animation accuracy that ViewPager has.
Please suggest me whether I should go for ViewPager or ViewFlipper?
Thanks in Advance.

Update (from 5+ years old original post):
Use ViewPager2 from JetPack. That's it.
I left original answer below but just for reference. Please do not use very old and not maintained widgets (like Gallery and ViewFlipper any more):
Intro: On first thought, I would recommend Gallery widget instead of ViewFlipper but it is depreciated since JellyBean (API 16), probably because of bad recycling of non-visible elements implementation.
Answer: What u really should use now is ViewPager or HorizontalScrollView. In your case (despite not too much given details) I think is better ViewPager because according to documentation:
.. HorizontalScrollView is a FrameLayout, meaning you should place one
child in it, containing the entire contents to scroll ..
On the other side for ViewPager you should implement PagerAdapter to generate pages which will be shown in this view.
My final answer is A, ViewPager ;)
Hope u will find this helpful ;) Cheers

Related

How to slide images with Viewpager in Android?

I want to slide images using Viewpager, and a number of pictures should be used. (like 30)
When you swipe the screen, The images must be changed. (So you should use Viewpager.)
of course i can do this by using 30 fragments for the images,
but that's not what i wanted.
i want to use only one fragment.
I've been searching it for a long time and the only thing that i know is, getArguments() and setArguments() would be helpful,
but still have no idea how to do it..
Please let me know.
*not good at English tho..
Use ViewPager2. Undercover it's contain RecyclerView that allows you to reuse fragments that goes off the screen.

How To Add RecyclerView With Cardview In A TabLayout ViewPager - Fragments

Good day, I just would like to ask if, how do I implement this one - RecyclerView-CardView inside a Fragment layout. I'm new to Android Dev (Doing Self-learning Stuff).
I just include my layout (cardview_org.xml) in the Organization-Tab for sample view on how it looks like. I created 3 cardviews and 3 rows_list.xml (recyclerview) , each tab (different design and data to be shown).
My main question is, how do I make this one possible? And in each every classes of these fragments, do i need to override onCreate() and put those adapters,initialize RecyclerView and etc on it's own classes?- from Android documentation - fragment life cycle.
These are the sites for my reference on making this thing. Android Warriors - Android ReyclerView with Animations
Sorry for this tricky questions, but hoping you get what I mean.
If you can provide video links or weblinks, I humbly appreciate it..
Many Thank you in Advance.

How to display adjacent tabs in ViewPager?

Here is a sample from duolingo app:
I want to implement a similar feature. I can use ViewPager to make swiping tabs. What I can't seem to figure out is how to display the adjacent tabs (part of it) alongside the current tab, which is in the center.
I initially thought of implementing this using horizontal LinearLayout, but I don't know how to make the snapping effect. And it also seemed more reasonable to use something which already provides you with swiping and snapping than try to implement your own.
Using ViewPager also let's me use fragments and memory management is also effective for cases of more than a few tabs.
Any help will be appreciated. Thank You in advance.

How to create a Hulu or IMDB style ViewPager in Android?

I've only been learning android for a few days now (beginner) and I'm quite not able to create a ViewPager as fine as these:
Is it possible to create a ViewPager inside a Fragment. If so any clue on how to proceed with creating such?
As a side note can some also please answer this question: I read somewhere that nested Fragments are possible, is that how these apps are created?
could you put a ViewPager in a fragmnet? Yes, Is this what they are doing? I dont know.
Quick example of setting up nested fragments is here
It could be an activity with a viewpager at the top in a scrollview too
You can do this. You have to use ViewFlipper and have multiple layouts within that PageViewer, each will be a "page." Here is a good tutorial on how to use this.
http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/

How to swipe between pages or layouts without using ViewPager or ViewFlipper?

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

Categories

Resources