cymcsg / UltimateRecyclerView

A RecyclerView(advanced and flexible version of ListView in Android) with refreshing,loading more,animation and many other features.
Apache License 2.0
7.22k stars 1.43k forks source link

How can I add a single header at the RecyclerView? #118

Open OneManStudioDotSe opened 9 years ago

OneManStudioDotSe commented 9 years ago

I can't seem to find a way to add a simple header at the RecyclerView. If I use the sticky headers functionality, a sticky header is added at every list entry.

What I want is a simple header (with its own layout) at the top of the list that will either scroll with the list or be sticky.

Is there something that I am missing or this functionality is not available at the library?

sergii-frost commented 9 years ago

@OneManStudioDotSe I think you should use methods like:

ultimateRecyclerView.setParallaxHeader(View view);
ultimateRecyclerView.setNormalHeader(View view);

You can check usage here: https://github.com/cymcsg/UltimateRecyclerView/blob/master/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/MainActivity.java#L92

sergii-frost commented 9 years ago

At same time this seems not to work when using MultiViewAdapter unfortunately :( I have checked out whole project and it works perfectly when header is added from MainActivity but does not work when to add same code to MultiViewTypesActivity

OneManStudioDotSe commented 9 years ago

It works for the simple case that I want it. Thanks :)

Rainer-Lang commented 8 years ago

@OneManStudioDotSe Did you have success with the header? I also need to add one at the top and the header should scroll with the list.

UPDATE: But in my header I also have clickable elements...

PabloDesiderioFlores commented 7 years ago

+1 MultiViewAdapter