Moving horizontally to another layout - android

I want to download a list of topics from server (e.g. 40) and then put them on a ListView. By swiping left or right you could download another list of topics and put them on a ListView.
ListViews would be like pages that you can scroll horizontally.
A good example of this is Google Reader. You can swipe left or right when you are in a topic to see another topic.
This isn't in fact a big problem but I would like it to look smooth like in Google Reader. It shows how the last page moves off screen and new page moves to middle.

If I understand correctly, then you might take a look at ViewPager.

Related

Vertical Stacked Views

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.

Custom Menu with swipe items

Currently I'm developing a small app for my parents' business. I'm trying to create a custom menu. I'd like to have something similar to this:
If you look at it, the screen is divided in two sections. The upper section is just an image and the lower section is the menu. I'd like to achieve this:
If the user places his finger over an item of the menu and swipes to the right, all the items move one position right, and the opposite if the user swipes left.
I'm quite new in this field and I'm not looking for a piece of code. I just want some tips on what to search because I don't know even where to start.
Thanks a lot!
By what I understood, ViewPager should be able to solve your problem. You hsve it nested in your layout under the main image. Have a look here: http://developer.android.com/training/animation/screen-slide.html

Alternatives to android.widget.Gallery (not the Gallery app)

Apology if this has been asked before, but I've tried googling the topic without any good result. Basically I'm trying to find a replacement for Gallery widget which Google has decided to deprecate. So far I have the following candidates:
ViewPager. Unfortunately (as far as I know), you can only display one View at a time. I know someone has posted a workaround for this here: https://gist.github.com/devunwired/8cbe094bb7a783e37ad1. But I'm having problem with this approach. On my phone, three images are shown (horizontally). The most left & the most right are static, while the middle one is scrollable (like what ViewPager should do). i.e. the most left & most right image doesnt scroll as I scroll the ViewPager. So I have to turn down this solution.
GridView. Seems good, but it seems like GridView is designed to be scrollable horizontally & vertically. I just want one row, and scroll horizontally. As far as I know, Gallery is not designed with this in mind.
HorizontalScrollView. Another one that Google has suggested in the Javadocs (apart from ViewPager). Seems like a good one to use, but... if i understand it correctly, using this approach all the contents are going to be instantiated up front. There is no lazy loading..
So I'm puzzled right here. Seems like the best solution is to either use ViewPager with only one View at a time (undesirable for what I want), or stick with Gallery.
What do people think??
Thanks in advance!
android.support.v4.view.ViewPager is the definitive answer.
You can display any number of pages (Views), it all depends on the PagerAdapter. It has a method .getPageWidth(position), which gets called for each page. If it returns 0.5, for example, the page will only be half the width of the ViewPager.
Don't stick with Gallery, as it has memory leak issues.

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!

ListView with a (half- and or) hidable header

My Problem, is that I don't even know what to search for.
I want a ListView.
This ListView has some Elements with a "sticky" state.
If I scroll down the List on the device, I want that all ListElements with state "sticky", to be sticky ontop of the list (non-scrollable) till there is another one "pushing it away". The rest of the elements are supposed to scroll as normal.
I've seen that kind of List in the Google Market. If you have a big screen you can see that list on the Detailview of any app on the left side or if you have android JB, the same effect is on the google search bar in the google now app.
Image One: You can see the normal ListView on the left side
Image 1 http://www.android-hilfe.de/attachments/android-app-entwicklung/120884d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste1.png
Image Two: You can see the normal ListView scrolled up a bit
Image 2 http://www.android-hilfe.de/attachments/android-app-entwicklung/120885d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste2.png:
Image Three: You can see, what I actually want. The View is scrolled up but the "sticky" price does not disappear. Instead of that all other elements, went under the "sticky" one
Image 3 http://www.android-hilfe.de/attachments/android-app-entwicklung/120886d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste3.png:
How do I do that?
I think that you meant to do some "synchronized scrolling".
There's a great post explaining how they've done in on Google Play:
http://www.pushing-pixels.org/2011/07/18/android-tips-and-tricks-synchronized-scrolling.html
Hope that's what you were looking for..
I believe that is a separate component, not related to ListView in any way.
Just create the header, let it be a RelativeLayout, or LinearLayout, and fill the rest of the area with the ListView set to fill_parent. Then, when you'll scroll the ListView, the "header" will stay sticky (as it is a separate component), and the list will scroll down.

Categories

Resources