Collapse/Expand Animation from Android Master-Detail Fragment [closed]

I am making an Android application in Android Studio.

There is a certain animation that Master-Detail Fragments have that I would like to replicate in my own app to improve User Experience. The animation I am talking about is in this video.

As can be seen, when the user scrolls/swipes the purple section at the top minimizes and the text slides to the right. The opposite happens when scrolling back up.

Does anyone know how I can set this animation to a RelativeLayout or any type of View in an Activity that is not a Master-Detail Activity? Are there any links or tutorials that someone can point me towards?

I have tried looking for the code that does this in the auto-generated Master-Detail Activity Android Studio made for me when I selected File--> New Project.