Putting a header view above a RecyclerView? - android

I want to implement a header/list combination similar to what you see in the Instagram profile screen, where the header scrolls away and you scroll through the user's posts.
You can't use a scroll view that contains everything since that would mean having to load all the list items up front. And if you use the RecyclerView the scrollbar is in the RecyclerView and doesn't scroll the header away.
I suppose the header can be made into rows in the RecyclerView, but that seems kind of hacky. Is there a better way I'm not seeing?

Check out these scroll tricks using the new Toolbar class in Lollipop: scrolltricks
He implements the exact functionality Instagram has. The ActionBar scrolls away upon scrolling down.

Related

Load all RecyclerView items at once

Default RecyclerView feature is to load only those items which are visible and load rest of the items as needed when user scrolls the list.
But my requirement is to load all items at once.
Any idea how to achieve this.
I am loading a Book and each page has multiple images for every line.
I am loading one image per item and I need to implement auto scroll feature for which I need to calculate whole recyclerview height.
I think instead of changing the default behavior of recyclerView if its possible use listView/gridView (until and unless you need StaggardGridView of recyclerView)
Just keep Recyclerview inside NestedScrollView. In simple first all the views regarding recyclerview items, that of cards is set to NestedScrollView and the things goes perfectly.

Have an item stick to the bottom of a RecyclerView

I have a vertically scrollable list using a RecyclerView. The layout I'm trying to implement is that when you scroll down far enough and reach a specific item, if you keep scrolling past this item it will stick to the bottom of the screen while the rest of the list continues to scroll behind it. Currently it's implemented by having a scroll listener on the RecyclerView and manually adjusting the position of the sticky view as required, but this is hacky and hard to build on.
Is there an easier way to have this kind of layout? I am currently investigating using a CoordinatorLayout but I'm not sure if it's the right tool for the job.
You can accomplish this using a CoordinatorLayout with a custom behaviour. The behaviour should be applied to the sticky view and make it appear/disappear as the RecyclerView scrolls. You have to override onStartNestedScroll in your behaviour to return true to receive calls for scroll changes.

Be able to scroll RecyclerView behind Keyboard

I want to be able to scroll a RecyclerView behind a keyboard. The issue is that if I have say more than 5 items in the RecyclerView.Adapter, and assume that each item might have a height of say 100dp. I want to be able to scroll the RecyclerView down with the keyboard still up and be able to scroll down to be able to see the first item in the RecyclerView.
In iOS you can set something called a contentInset on a NSTableView and that gives you extra scrolling space below the list. I am looking for something similar for the RecyclerView so far, there isn't much to go on.
INITIAL STARTING POINT
WHAT HAPPENS (Can't scroll down anymore)
WHAT I WANT (be able to scroll down)

ListView with moving header?

I want to create listview with header which move with listviews scrolling. I tried it :
ViewGroup listviewheader = (ViewGroup) inflater.inflate(R.layout.listview_header , list1,false);
list1.addHeaderView(listviewheader);
But it only appears when user rise to top of the listview. I want that when user rise a little bit (everywhere in listview) then the header appear in top. How can i do it?
Check this library: https://github.com/ManuelPeinado/QuickReturnHeader
"A ListView/ScrollView header that hides when scrolling down and reappears immediately when scrolling up, regardless of how far down the list we've gone. Like the one from the Google Keep app."
https://github.com/felipecsl/QuickReturn
-- Quite easy and useful implementation

Scrolling grid view hides other control on top of activity in android

On scrolling down gridView.
I want to scroll my three tabs on top as shown in second image.
And on scrolling up back shows that again like first image.
I have checked paralloid library, but not sure if it solves this problem or not.
Same functionality i found in google+ android app. In profile page on scrolling tab scroll till they reach on top. after that list view scrolls.
GridView already has scrolling built into it, so its children should scroll separately than its siblings by default. No extra library should be needed for scrolling down, although scrolling horizontally is a separate issue.

Categories

Resources