How to add floating action button on top of scrollview

后端 未结 4 1714
难免孤独
难免孤独 2021-01-04 02:19

I have a floating action button that I would like to add on top of a scrollview so that the button stays, even if you scroll. I want it on the top of the scrollview and in t

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-04 02:54

    You can use android.support.design.widget.CoordinatorLayout as parent layout. Make two xml one in which you can set scrollbar or list. Other is parent container who hold the entire info with your FloatingActionButton.

    activity_main.xml

    
    
    
        
    
            
    
        
    
        
    
        
    
    
    

    content_main.xml

    Here you can put your ScrollBar. Its pretty easy.

    
    
    
        
    
            
    
    
                
    
                    
    
    
                
    
                
    
                    
    
                    
                
    
                
    
                    
    
                    
                
    
                
    
                    
    
    
                
    
                
    
                    
    
    
                
    
    
            
        
    
    

提交回复
热议问题