How to set toolbar title appear on scroll from bottom as it implemented in Apple Music Android app? [closed] Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How to set toolbar title appear on scroll from bottom as it implemented in Apple Music Android app? [closed] without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I want to implement scroll behavior for Toolbar title as its implemented in Apple Music Android app.

Detailed screenshots of its behaviour: Initial State, Start scrolling, Continue Scrolling, End of scroll

Thank you in advance!

Answer

As Piyush said, https://github.com/brucetoo/Android-ObservableScrollView is exactly the library you need for this. This is how you’d go about it

  1. Import the library by going to your app’s Gradle file and pasting this

    implementation 'com.github.ksoichiro:android-observablescrollview:1.5.0'
    
  2. Make your xml layout and instead of using a standard ScrollView to wrap it, use an ObservableScrollView. Outside of the scroll view, make a toolbar that will host your menu buttons as well as the title i.e. “Library”

  3. In you Java/ Kotlin file, attach a listener to the scroll view by using listView.setScrollViewCallbacks. Provide an object implementing the ObservableScrollViewCallbacks interface as an argument.

  4. In the callback, change the YTranslation and alpha values of the title in your toolbar based on the scroll factor

I don’t have android studio in front of me, so I can’t provide any code, but this is the jist of it.

We are here to answer your question about How to set toolbar title appear on scroll from bottom as it implemented in Apple Music Android app? [closed] - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji