Vertical Stacked Views - android

I'm struggling for the past 2 days to find/implement an working solution for my UI requirements for an on boarding flow. This is how the UI should look like:
These pages should be scrollable vertically only.
As you can see, the pages should be stacked on top of each other. The current page (the top one) should also resize if not the first one so that the user can see the top edges of the already swiped up pages.
Beside the arrangement of the pages, when the user swipes an page up or down, there should also be an page transition, something similar to DepthPageTransformer, or at least to easily support changes for these transitions.
Until now I've tried:
Custom vertical ViewPager
Custom ScrollView with custom listener and one-by-one item scroll
Flippable StackView (and multiple other implementations of StackView)
But I've failed to achieve the desired result using any of these approaches.
The flow is similar to the linkedin flippable stackview, with the difference that my requirements are for an vertical widget and with some small minor adjustments which can be adjusted afterwards.
Can someone please help me with this or at least guide me into the correct direction?
Thank you.

Related

What's the difference between HorizontalScrollView & ViewPager?

I'm new programming in Android and i have many doubts about what type of classes can i use in my first app.
I want to do a level menu like cut the rope or angry birds. Only a title and a slider menu.
I think that can do with the two classes, but I'm not sure which is better, can you tell me the difference and which is better to use?
Many thanks.
ViewPager allows you to flip between pages of data (between views). You supply an adapter to generate the pages that the view shows.
But HorizontalScrollView is a container for other views that you can scrolled through, allowing it to be larger than the physical display.
I would go with horizontal scroll view.
EDIT : See FoamyGuy's answer in Angry Birds like scrolling menu where he exactly explains how to achieve such effect.

multiple screens to scroll horizontally, but not vertically

I am trying to achieve multiple scrollable views on one activity.
I am using viewpager, in each screen there will be multiple buttons using baseadapter, where clicking on one will start certain level, similar to what you see in many of the current games.
I managed to do this and it is all good, one thing I couldn't do is to stop the page/buttons from scrolling vertically, even when all buttons are already on display, you still can scroll them up and down :(
when you scroll horizontally, it goes to the next/previous page, that is good, but how to disable scrolling vertically?
I am considering doing the hole thing in canvas, and make it from scratch, I just don't want to do it the hard way and want to learn the easy way of doing it, if there is any.

Want horizontal scrolling to stick with columns instead of whole pages (fragments)

I want to show several columns in one Activity. If there are more columns than can actually fit the screen, user should be able to swipe left and right to move among these columns. This can by easily done by ViewPager or HorizontalScrollView.
However I would like the user to see each adjacent columns on one screen.
A picture should better explain my intention:
(to clip or to stick.. don't know what word I should use)
Am I able to make ViewPager or HorizontalScrollView to stick with columns instead of whole pages (fragments)?
Or do you please know of any open source projects that achieve desired behaviour of ViewPager / HorizontalScrollView?
EDIT: I've found out that similar behaviour appears in a few examples of API Demos app!

Vertical 'Gridview with pages' or 'Viewpager'

What I functionally need is a Vertical ViewPager with GridView.
So every page of the ViewPager should have a GridView, but the ViewPager is horizontal.
So there are two possibilities:
Rotate the ViewPager with GridViews
Create a GridView that shows the items in pages
The GridView should show 0-20 when the user scrolls 20-40 etc etc.
Does anyone have a solution for this?
I have checked this link, but I cannot use it cause of legal reasons.
Sounds like what you really need is a vertical ViewPager. Although Android only provides a horizontal one, there's nothing that prevents you from implementing it yourself. Get the ViewPager source code and modify it to detect swipes up/down instead of left/right. The source is distributed under Apache 2.0 license, therefore you have full rights to create derivative works without having to distribute the source of it.
There will be very few places to change, specifically, methods related to computing the swipe direction/slope (up/down instead of left/right) and methods related to layout computation (using height instead of width and layout pages below each other).

Android Gallery Jumps when swiped quickly or slowly

I've made an activity that looks a lot like the level select screen from angry birds: there is a grid of button, and you can scroll through pages of them by swiping right or left.
I built it by creating a layout of the buttons, and then adding those layout to a Gallery view.
The problem is the animation is jerky, even if you swipe extra slowly, the content jumps ahead. Even when you fling the gallery page, it skips and jumps along its way to its destination.
I am wondering how to fix this: Maybe the complex layout it making it non responsive during the inflate?
Do you know how to fix this, or of a good way to do a workaround using some other approach that will let me have 3 or more screens smoothly swiping from page to page?
You should be using ViewPager. This is available in android support packages. Gallery Widget will not be smooth if you add components into it which has a lot of touch actions.
http://android-developers.blogspot.in/2011/08/horizontal-view-swiping-with-viewpager.html

Categories

Resources