I want to implement a viewpager like the one below
I found this example Cover Flow feature using view pager android but it only inflates the image to the left and does't show the other two to its side.
Try this
viewpager.setClipToPadding(false);
viewpager.setPadding(left,0,right,0);
To set margin between two pages
viewpager.setPageMargin(10);
Related
I am relatively new to android and stuck on this particular implementation.
How do i implement a View(RecyclerView) with Horizontal GridLayoutManager(3*5) along with PageIndicator so basically 1st page would show 15 images, swiping left would show another 15(PageIndicator would change color) and so on.
Thanks in advance!!
you used viewpagerand set recycler view in viewpager or gridview. viewpager to handle swipe and easy. and you give it pageindictor in viewpager it's implement is easy.
you use recycler view in you give left is hard and you do use pagination so it's implemention is hard
It's frustrating when you are been downvoted, and i understand that, hence i tried to implement this myself and the implementation details can be found here
Adjust Items inside recycler view + orientation changes.
I Would like to achieve the following
I was able to use the following library
https://github.com/Hongchae/CoverFlowPager
and after some customization i was able to have this
Now i want to adjust the pages to appear like the first image
Appreciate your help ,Thanks in advance
For showing the preview of left and right fragments you have to set the following values:
// This for avoiding the truncate effect
viewpager.setClipToPadding(false);
// This for setting the padding for seeing the other fragments
viewpager.setPadding(left,0,right,0);
To modify the space between the fragments in the viewpager use
viewpager.setPageMargin(int);
probably this post will help you ViewPager show next and before item preview on screen
I tried searching but can't seem to find a swipeable view that can only swipe only half.
Here is an example image.
I tried creating two pages (in a tab) that contains image 1 and image 2, but the animation is having two stars when you are in mid-swipe.
Cheers.
Edit: found a working example. I will just try mimicking this one.
https://github.com/baoyongzhang/SwipeMenuListView
You can use two ViewPager to serve for this purpose and customise them in a way so that one ViewPager change the other. In this way, I will give a feel that it is being swiped from half.
I am new to view pager in android. I want to make my view pager like this.
In this my problem is to making the circles with the number showing. How can I achieve this in android.
I have tried the view pager customizations methods but I didn't succeed. Please tell me how can I achieve this type thing in android.
I have written true ViewPager indicators similar to PagerTabStrip which are embedded in the ViewPager and they are a pain.
This indicator looks like it might be separate from the ViewPager anyway, so here is an easier way to do this sort of thing:
Make a custom widget that extends LinearLayout. This will be a horizontal layout. Have it also implement ViewPager.OnPageChangeListener.
In the setup of this widget, you add ImageViews to the LinearLayout with the drawable set to the circle of your choice. Use ViewPager.getAdapter().getCount() for the number of circles to add.
in the onPageSelected() method, use the position argument as the index to LinearLayout.getChildAt() to get the ImageView that represents that selected page. Set the drawable to the image that represents your selected page. Don't forget to reset the ImageView that was previously selected!
Call ViewPager.setOnPageChangeListener() with your widget.
Now if you also want to put a number in there, the views you add to the LinearLayout will need to have a TextView as well. You'll also need to get the data to go into the TextView, perhaps from a custom method on the PagerAdapter.
Also, I'll bet the app you are referencing has an animation showing the bubble expanding.
I'll try to post some code later.
The TabCarouselLibDemo source is here. Thanks for the author's work.
The demo shows the ViewPager is below the tab, but in the xml, the ViewPager seems that it is at the top of the tab.
I think if you can see the demo you will understand what I mean.
I have a question about how to make the ViewPager below the tab? I have seen nothing about it in the code.
It makes me feel uncertain.
Thank you in advance!
It has to do with how RelativeLayout draws its children. If the ViewGroup was a LinearLayout and the orientation was set to "vertical", the carousel would be placed below the ViewPager, like you're thinking. But that's not how RelativeLayout works.
As far as the content in the ViewPager being below the carousel, you have to look at the custom Adapter used. There's a layout called "faux_carousel" that's used to create a layout with the same dimensions as the actual carousel, without showing the carousel itself. That layout is placed at position "0" in the Adapter so that all of the other content (that's in the ViewPager) will rest below the fake carousel and therefore the real one too.