How to create vertically nested scrollviews with viewpager content - android

This is in a lot of apps, where there is header content a view pager and then the pager content. The header content can scroll off the top then the pager content docks and continues to be able to scroll. I've tried a couple ways of doing this, I had the most success with using NestedScrollView, but I was never able to get fling and a few other use cases working right. As far as I can tell the apps that do this all spin their own solution.
I'm looking for suggestions on how to go about building this type of ui. Below is Google+ which uses this ui.

This is not exactly an answer (the question itself is quite open-ended) but I found cheesesquare implementation by Chris Banes (he's from the android team i think) very helpful with what you're asking.
https://github.com/chrisbanes/cheesesquare

What dejavu86 has said. The app in question is a demo of Design Support Library which has the UI widget, CollapsingToolbarLayout, which you are asking about.
http://android-developers.blogspot.co.uk/2015/05/android-design-support-library.html

Related

How to create an Google Currents like layout

Does anybody know how the article layout in the Google Currents Android app is built? I'd like to use some very similar layout for my app.
Example:
The first thing which came to my mind was to build up an the layout with a WebView with multicolumn stlye (http://www.w3.org/TR/css3-multicol/). Am I on the right way or is my suspicion completely wrong.
How do I get the page flip through the swipe/fling gesture and how to get the corresponding page indicator at the bottom?
Thanks in advance! :-)
You must use native views android and not webView because it is not efficient. But if you begun on Android you can actually use a webView is a good learning.
However, if you're interreses the layout android http://developer.android.com/ the website is a very good teaching technique. And what is the view of pourfaire text scroll from right to left, I encourage you to use the library ViewPagerIndicator.
I hope I have helped you!

Create Carousel Style ViewPager

I'm looking to try and implement this style pattern into my application:
http://www.androidpatterns.com/uap_pattern/carousel
But I am having trouble in finding an existing library or solution to it. Does anybody know of any libraries that I could use or how I would go about implementing this?
So far, Ive found this:
http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html
but it isn't quite what I want as it would be nice if it was hosted inside of a ViewPager so I can have buttons etc inside the view.
You might try twoway-view, an implementation of an AdapterView (similar to ListView/GridView) that supports horizontal scrolling.
In this case, you'd use it more like a ListView rather than a ViewPager, so each element would be a separate item layout, rather than Fragment.
One example of where twoway-view is in use right now is the latest Firefox for Android nightly as discussed on the announcement post, which contains some screenshots of it in use:

Android - Pull-down Refresh Feature on LinearLayout

I wanted to ask can I implement pull-down refresh option on a linear layout control, I have read this & other examples also but they all are for "ListView" control.
#MH
Have a look at Chris Banes' pull-to-refresh implementation, which is available for several views, including ListView, GridView, ScrollView and WebView. You might be able to simple use the ScrollView version and wrap that around your LinearLayout. Alternatively it should be relatively easy to implement your own using the building blocks in that library.
This Worked for me.

Horizontally scrolling Grid Lists?

There are a lot of questions on here asking about horizontally scrolling GridViews. A few have answers that lead to some custom classes that manage to do it, yet Google clearly indicates there a standard way to do this. They have an entire page about it in their Design section: Grid Lists. This page illustrates horizontally scrolling grids and implies strongly that this is normal, supported behavior (as it should be). They go into great detail about WHEN to use it. Unfortunately, they neglect to mention HOW to do it. I have searched all day to find an example of how this is accomplished with GridView or any other standard Android UI class, regardless of SDK version. Is their documentation wrong? What is this page referring to?
yet Google clearly indicates there a standard way to do this
No, they do not.
They have an entire page about it in their Design section: Grid Lists.
They have material in the Design section for which there is no out-of-the-box implementation in the Android SDK. Other examples include the drawer, some of the gestures, and section headings in lists.
Is their documentation wrong?
It is design documentation. To that extent, it is not "wrong" to have a design that calls for a horizontal-scrolling GridView. The mere fact that the Android SDK does not supply one -- at least at the time of this writing -- does not preclude somebody creating one.
What is this page referring to?
Grids.
try an xml with the following;
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<GridView
//your layout
>
</GridView>
</HorizontalScrollView>

Implementing swiping between different views

I've been updating an Android app today which so far had a single TableLayout-based View. Now, I'd like to duplicate that View with another set of backing data, and use horizontal swiping to switch between both. At some point I'd also like to add a third "page" with a different TableLayout.
I haven't really found any good ways to get this going. I've been looking at http://developer.android.com/training/implementing-navigation/lateral.html, and I actually copied the code fragment for the Tabs Pattern with NAVIGATION_MODE_TABS. That results in a little dropdown widget being added to the View title in the action bar, but clicking it doesn't show the tabs I set up (with actionBar.addTab()). I'm also not sure how to set up the view (XML) code to stick the TableLayouts in there.
I should mention that I don't have to care for pre-4.0 Android for this, so compatibility is not (much of) an issue.
Try to Use ViewPager Widget you can find useful links on the web, this widget handle the horizontal swiping between views.
http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
https://github.com/JakeWharton/Android-ViewPagerIndicator
http://blog.stylingandroid.com/archives/537#
I haven't really found any good ways to get this going.
Try ViewPager. Here is an Android Developers Blog post on ViewPager: http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
Here is a small sample app using ViewPager: https://github.com/commonsguy/cw-omnibus/tree/master/ViewPager/Fragments
None of the other answers ended up helping much. However, this one is pretty good:
http://thepseudocoder.wordpress.com/2011/10/05/android-page-swiping-using-viewpager/

Categories

Resources