How to hide ActionBar while scrolling ListView in android?

后端 未结 4 610
南旧
南旧 2020-12-10 01:23

I need to create a GUI with a ListView and an ActionBar which will hide when scrolling down and when scrolling up it must reappear.

The foll

4条回答
  •  天命终不由人
    2020-12-10 01:57

    I would recommend using the new support design library by Google.

    Include it in your dependecies:

    compile 'com.android.support:design:22.2.0'
    

    and then use the AppBarLayout together with NestedScrollView.

    For your Toolbar define app:layout_scrollFlags="scroll|enterAlways", which says it will disappear as you scroll, and come back immediately if you scroll up (meaning you don't have to scroll all the way up).

    
    
        
    
    
    
    
    
        
    
    
    

提交回复
热议问题