Reputation: 300
I want to design a app which have a new feed screen like Instagram app.
If you have used Instagram you can see when you scroll up the toolbar will push up and replaced by header of feed. (Ok, I can do it which android support design) .
When you continue scroll, the header of the second feed will push up and replace the header of the first. I wonder how can they do that ? How can they detect when an item is over ?
This video demo how instagram app scroll :
https://www.youtube.com/watch?v=ThzZlrKVY-g
Sorry about my grammar, Thank in advanced !!!
Upvotes: 1
Views: 7814
Reputation: 242
I think you're leaning towards Sticky Headers. There are many existing lightweight libraries out there that will make your life easier.
Check out StickyHeadersRecycleView (Has a GIF to show how it works)
Alternate option, also a library.. StickyHeader
Upvotes: 1
Reputation: 19
You could try these steps. I've done it before using this steps.
1.) Create a ScrollView on your main layout with LinearLayout inside it
2.) Create a Fragment for a layout you need (Image and a comment section below)
3.) On your MainActivity Inflate the fragment inside the LinearLayout as much as you need(inflate the fragment for each images).
Upvotes: 1