CollapsingToolbarLayout expand only when at the top

后端 未结 5 931
耶瑟儿~
耶瑟儿~ 2021-02-05 17:58

I have some problems with AppBarLayout and CollapsingToolbarLayout. This is what currently happens:

https://www.youtube.com/watch?v=z4yD8rmjSjU

The downwards scr

5条回答
  •  不要未来只要你来
    2021-02-05 18:11

    I think you can manage that from your code ,I have tried that by simply detecting behavior of layout

     app_bar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
        @Override
        public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
    
            if (Math.abs(verticalOffset)-appBarLayout.getTotalScrollRange() == 0)
            {
                //  Collapsed
    
    
            }
            else
            {
                //Expanded
    
    
            }
        }
    });
    

提交回复
热议问题