Android RelativeLayout and height of wrap_content?

前端 未结 2 760
挽巷
挽巷 2021-02-10 09:30

I am trying to make a selection ListActivity, similar to the one used to add shortcuts to the launcher screens. I have rolled my own header and footers, which I would like to be

相关标签:
2条回答
  • 2021-02-10 10:12

    According to the developer documentation your desired behaviour is not possible for Relative layout ;

    "Note that you cannot have a circular dependency between the size of the RelativeLayout and the position of its children. For example, you cannot have a RelativeLayout whose height is set to WRAP_CONTENT and a child set to ALIGN_PARENT_BOTTOM."

    RelativeLayout

    To solve your problem you could maybe try to use a linear layout, set to wrap_content and set max height via code to screen height.

    You can get the screen height as described here : get screen height

    0 讨论(0)
  • 2021-02-10 10:13

    I just change my RelativeLayout in FrameLayout and all starts to work

    0 讨论(0)
提交回复
热议问题