Collapsing Toolbar with RecyclerView

Поділитися
Вставка
  • Опубліковано 15 жов 2024
  • In this video I show you how to implement some custom scrolling behavior for toolbars when used in the same layout as a RecyclerView.
    Many people don't know this but a RecyclerView is designed to work with a CoordinatorLayout, AppBarLayout, and Toolbar to implement these custom behaviors. It's very simple. All you need to do is specify some attributes in the xml.
    There's many different scroll flags you can use. Some examples are: SCROLL_FLAG_ENTER_ALWAYS, SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED, SCROLL_FLAG_EXIT_UNTIL_COLLAPSED,
    SCROLL_FLAG_SCROLL,
    SCROLL_FLAG_SNAP, and others.
    ➤ The best Android courses in the WORLD:
    ↻ codingwithmitc...
    ➤ Android development for complete beginners:
    ↻ codingwithmitc...

КОМЕНТАРІ • 38

  • @amaywadar5334
    @amaywadar5334 5 років тому +4

    Thanks... Will be using this from now on.. looks clean

  • @Anik70053
    @Anik70053 4 роки тому

    Very helpful resources and easy explanation. I just wanted to thank you for making the resources available for eager learners like me. I am greatly benefited from your videos and resources.

  • @thiagosouza8931
    @thiagosouza8931 3 роки тому +1

    Tip: If you want to use something other than recyclerview, you put a NestedScrollView (with app:layout_behavior="@string/appbar_scrolling_view_behavior" attribute) and whatever you want inside it.

  • @natanfelipe3002
    @natanfelipe3002 3 роки тому

    Nice. Thank you

  • @weihenglu691
    @weihenglu691 5 років тому

    Respect the attitude of teaching, when he opened the android studio again for the beginner

  • @JayeshBabuAV
    @JayeshBabuAV 5 років тому +2

    Thank u very much for this tutorial, sir.. Will this work if the recyclerview is in another fragmant and that fragment is displayed using a viewpager below the appbarlayout?

  • @dediatib6573
    @dediatib6573 5 років тому +1

    Love your tutorial, clear explanation... :)

  • @mehulbisht9708
    @mehulbisht9708 4 роки тому +4

    7:57 so the problem with my code is that i have a viewpager with tablayout and so i'm switching fragments with it, and the recyclerview is inside the fragment but toolbar is common to the activity, and hence i'm not able to implement this scrolling feature ( wanted to make it just like whatsapp ). Also, when i use this method, the toolbar and tablayout get separated by a line that i donot want because whatsapp doesn't have that either...i'm not a member or on your discord but still, any help fom your side will be appreciated !!

    • @ELGOYANO96
      @ELGOYANO96 3 роки тому

      did you resolve that issue? I have the same problem with a bottom navigation button which is used everywhere but idk how to trigger the behaviour on it when the recycler view is in a viewpager which is also in a fragment

    • @mehulbisht9708
      @mehulbisht9708 3 роки тому

      @@ELGOYANO96 It wasn't a real project but just some testing that I did back then, but what is the exact issue you have? I remember making a toolbar inside an appbar and then I got rid of that line I talked about as far as I can remember.

  • @KothsadaSrihanouvong
    @KothsadaSrihanouvong 5 років тому +1

    Thanks alot, nice tutorial

  • @KIRILLINGUSS21
    @KIRILLINGUSS21 5 років тому +1

    Thanks a lot for tutorials

  • @ujjwaldeep5175
    @ujjwaldeep5175 4 роки тому +1

    Instead of recycler view I have a relative layout, now how to do that?

  • @sayantanbanerjee821
    @sayantanbanerjee821 4 роки тому +1

    Heyyy Mitch,
    After the libraries migrated from Support Design to Androidx, I haven't really come across anything which can make toolbars scroll. Can you suggest me with some links or your tutorial on these updated libraries on toolbars.

    • @codingwithmitch
      @codingwithmitch  4 роки тому

      Any of my new courses on my website use scrolling toolbars with androidx. Just look on my github.

  • @ramy_c148
    @ramy_c148 5 років тому +2

    👋Thanks Mitch , i want the same design of Google play searchview , so please Mitch show us how to do it . ✌️💪

    • @codingwithmitch
      @codingwithmitch  5 років тому +2

      I show you in this course: codingwithmitch.com/courses/rest-api-mvvm-retrofit2/

  • @ivan8895-p8c
    @ivan8895-p8c 4 роки тому

    Thank you very much for tutorials , can you please make a tutorial for Expanadable Recyclerview with clicklistener? Thanks

  • @blockbusterlatefees7713
    @blockbusterlatefees7713 5 років тому

    I want to recreate the way eBay has its Toolbars setup. So they have one Toolbar always at the Top and the "search" Toolbar is the one that has the scrollFlags. When I put 2 Toolsbars in a Toolbar Layout, one without the flags and the other with the flags, the scrolling effect doesn't work anymore. The scrollFlags seem to only work when there is only 1 Toolbar in a ToolbarLayout or if they Toolbars have the exact same scrollFlags. Any ideas? Ive been stuck on this for 4 hours now.

  • @pradeepkumarreddykondreddy7048
    @pradeepkumarreddykondreddy7048 3 роки тому +1

    How to make multiple views collapse into the toolbar ? I want multiple views like textview and imageview be there in expanded view and collapsed view. How can i achieve this ?

  • @dilshod_iskandarov
    @dilshod_iskandarov 2 роки тому

    Thanks big

  • @InPic
    @InPic 4 роки тому

    how to change the collapsing toolbar color when its scrolling up and making the color constant till reaches to the top ,i have already use setContentScrimColor() but that is not working for scroll till top.

  • @yassinemsiah2288
    @yassinemsiah2288 5 років тому +1

    can you please do a JWT Authentication System with Volley tutorial there aren't any good tutorials on this subject on youtube Thank you Very Much

  • @askdetanny8915
    @askdetanny8915 5 років тому

    Hi, I'm facing a problem. When I apply collapsing toolbar without androidx atifacts, it works fine. But when I add androidx atifacts in my project, it shows the error in the app behavior. It showing a red warning in @string/appbar_scrolling_view_behavior. What to do?

    • @codingwithmitch
      @codingwithmitch  5 років тому

      Try invalidate caches and restart.

    • @askdetanny8915
      @askdetanny8915 5 років тому

      @@codingwithmitch I have done that, but it's showing the same

  • @HabeshaDeveloper
    @HabeshaDeveloper 5 років тому

    its not related but i would like to ask u hw to make firebase realtime database pagination with load more functionality ... thank you

  • @vahekhachaturian2424
    @vahekhachaturian2424 4 роки тому

    What if I'm using NavigationView, and the root layout must be DrawerLayout?

  • @kosm10
    @kosm10 5 років тому

    hey i need help can you please do vidoe on how to use FrameLayout with viewpager that have fragments that using tablayout please please.
    I am trying to use a Navigation Drawer with a FrameLayout to display fragments.
    However, when clicking one of the items on the Drawer, I would like to display a TabLayout with 3 fragments
    So what architecture do I need to use?
    Should the Activity inflating the drawerlayout host the ViewPager and the FrameLayout?

    • @kosm10
      @kosm10 5 років тому +1

      sorry for being selfish , Thanks you so much for all the Tutorials ... and the spotify Course that i buyed was so good !!! worth the money i paid for to become member

    • @codingwithmitch
      @codingwithmitch  5 років тому

      hey,
      BTW if you're a member you should ask questions in the discord channel. You'll get help from me or the other members faster there. Better responses too.
      As for your question, you should read this material.io/design/components/navigation-drawer.html#usage.
      Pay close attention to the "do's" and "don'ts". The guidelines recommend not doing what you're trying to do (using a nav drawer with another primary navigation component like tabs)
      Another good reference: ux.stackexchange.com/questions/74934/android-ux-when-to-use-tabs-and-when-to-use-navigation-drawer

    • @kosm10
      @kosm10 5 років тому

      @@codingwithmitch i dont know if they both need to be primary navigation component ... but if i want to use them both like most of the music players that i know use both.
      even the music play of google. both mean to (Navigation view (for side menu ) and Framelayout (for playlists with tablayout that are my playlists) )
      i think people useing DrawerLayout as the main layout inside it FrameLayout as main container and inside the framelayout ther is viewpager that inside his fragment hold tablayout
      i know it is sound complex and i am sure it is.
      if you know how to do it or at least how to work with viewpager and Framelayout together i hope you can make vidoe on it.

    • @codingwithmitch
      @codingwithmitch  5 років тому

      @@kosm10 I have a video on ViewPager and tabs with framelayouts. You can check that out here ua-cam.com/video/bNpWGI_hGGg/v-deo.html.
      It's old but still works.

    • @kosm10
      @kosm10 5 років тому

      ​@@codingwithmitch From this vidoe i learn how to do my tablayout and this is how i do it on my music player Thanks to you. but it is using only Viewpager without Framelayout container. maybe i didnt explain myself very well.
      this link is for picture of Google Music Player. imgur.com/iJQiWcs
      i dont know a way to send you image. so i uploaded to this site.

  • @ManishKumar-eh4ol
    @ManishKumar-eh4ol 7 місяців тому

    this does not work with androidx

  • @tusharsoni5136
    @tusharsoni5136 5 років тому

    lets switch to flutter