Stop scroll on CollapsingToolbarLayout so it doesn't completely collapse

前端 未结 3 1502
生来不讨喜
生来不讨喜 2020-12-28 16:59

I have a CollapsingToolbarLayout setup and im placing a wallpaper there. I want to be able to stop it from collapsing all the way.

I have tried minheight and many ot

3条回答
  •  隐瞒了意图╮
    2020-12-28 17:09

    CollapsingToolbarLayout works really closely with Toolbar and as such the collapsed height depends on the toolbar.

    I was able to solve your problem using this layout (Note it goes into the normal CoordinatorLayout/AppBarLayout Setup, With Fab and a NestedScrollView or RecyclerView):

    
        
    
        
            
    
        
            
    
        
            
    
    
    

    The related activity looks like this:

        ...
        setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    
        // Disable toolbar title
        getSupportActionBar().setDisplayShowTitleEnabled(false);
        ...
    

    Here's a video of the interaction

提交回复
热议问题