Limit height of ListView on Android

后端 未结 16 1362
广开言路
广开言路 2020-11-28 23:07

I want to show a button under a ListView. Problem is, if the ListView gets extended (items added...), the button is pushed out of the screen.

16条回答
  •  臣服心动
    2020-11-28 23:42

    Found a way to do this without using nested containers, inspired from AngeloS's solution.

    I used a LinearLayout with a vertical orientation, that has a ListView and a button. I set the android:layout_weight="0.1" for the ListView.

    It manages to get the button stick to the bottom of the list always. And the button does not get pushed off the screen when the list grows.

    
    
    

提交回复
热议问题