How to create fixed footer in android layout?

后端 未结 3 484
眼角桃花
眼角桃花 2020-12-02 16:01

I am using following code to display button at the bottom of activity.



        
3条回答
  •  执念已碎
    2020-12-02 16:13

    If you had, for example, all the scrollable elements in a ScrollView, you should do like the following:

    
    
        
    
                
    
            
    
        
    
        
    
    
    

    Note that if you want the footer to be fixed, then you shouldn't put it in the ScrollView, where the scrollable content will be placed. Make it child of RelativeLayout and set layout_alignParentBottom to true. Maybe you'll need to add a padding at the bottom of the ScrollView in this case (so that the last element do not get hidden by the footer).

    The idea is similar for elements other than ScrollView

提交回复
热议问题