Limit height of ListView on Android

后端 未结 16 1367
广开言路
广开言路 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:28

    You can probably make this work using nested containers. It's possible that you might need to wrap the Button in a second (inner) container so that it takes up more space, and just align the Button to the top of the inner container.

    Possible something like this:

    RelativeLayout

    -- ListView

    -- RelativeLayout

    ---- Button

    Using the different alignment options on the two containers, you should be able to get this to work.

提交回复
热议问题