FrameLayout margin not working

后端 未结 7 1888
野的像风
野的像风 2020-12-04 09:46

My layout structure is like this

LinearLayout
    FrameLayout
       ImageView
       ImageView
    FrameLayout
    TextView
LinearLayout

I

7条回答
  •  佛祖请我去吃肉
    2020-12-04 10:13

    Taken from the FrameLayout docs (link)

    The size of the frame layout is the size of its largest child (plus padding), visible or not (if the FrameLayout's parent permits).

    This seems to describe the fact that it'll strip margins out. Like boulder mentioned, you could try switching to padding as it can be used to produce a similar effect if done properly.

    Out of curiosity, you mentioned that it does work fine when using a LinearLayout container, why the choice of FrameLayout?

提交回复
热议问题