Android Linear Layout - How to Keep Element At Bottom Of View?

前端 未结 8 1526
悲哀的现实
悲哀的现实 2020-12-08 01:50

I have a TextView which I want to pin at the bottom of a landscape activity that is using LinearLayout with vertically arranged elements.

8条回答
  •  离开以前
    2020-12-08 02:13

    You will have to expand one of your upper views to fill the remaining space by setting android:layout_weight="1" on it. This will push your last view down to the bottom.

    Here is a brief sketch of what I mean:

    
        
        
        
        
    
    

    where each of the child view heights is "wrap_content" and everything else is "fill_parent".

提交回复
热议问题