ksoichiro / Android-ObservableScrollView

Android library to observe scroll events on scrollable views.
http://ksoichiro.github.io/Android-ObservableScrollView/
Apache License 2.0
9.66k stars 2.06k forks source link

Showing/Hiding actionbar #101

Open mhdatie opened 9 years ago

mhdatie commented 9 years ago

Thanks for creating this useful library...I tried using the simple example to hide and show my actionbar. It works as expected but it doesn't animate (has a sudden effect instead).

I have downloaded your app and show() and hide() methods have animations in them, but I can't spot that in your example code.

Thanks again..

Edit: I'm using RecyclerView

MedoElkamaly commented 9 years ago

i have the same issue with a ListView that extends ObservableListView

mhdatie commented 9 years ago

@MedoElkamaly I fixed it. I was using a Toolbar, and there was an example for both ActionBarActivity and Toolbar.

That being said, if you get it to work and the toolbar leaves an unfilled area on hide, you will have to modify your Content view in the main activity layout file to lie underneath the toolbar (assuming it's a drawer layout or relative view).

After doing that, your first item will be hidden under your toolbar. To fix this, on inflate or bind, if your item position is 0, add a top margin or top padding equal to the size of your toolbar.

The views are recycled, this means some of the items will have the same dimensions as your first item at position 0. You don't want this. Make sure to set your dimensions identical to the XML file for any item at position > 0.