Android 4.4 — Translucent status/navigation bars — fitsSystemWindows/clipToPadding don't work through fragment transactions

前端 未结 8 2174
余生分开走
余生分开走 2021-01-30 11:30

When using the translucent status and navigation bars from the new Android 4.4 KitKat APIs, setting fitsSystemWindows=\"true\" and clipToPadding=\"false\"

8条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-30 11:58

    A heads up for some people running into this problem.

    A key piece of information with fitSystemWindows method which does a lot of the work:

    This function's traversal down the hierarchy is depth-first. The same content insets object is propagated down the hierarchy, so any changes made to it will be seen by all following views (including potentially ones above in the hierarchy since this is a depth-first traversal). The first view that returns true will abort the entire traversal.

    So if you have any other fragments with content views which have fitsSystemWindows set to true the flag will potentially be ignored. I would consider making your fragment container contain the fitsSystemWindows flag if possible. Otherwise manually add padding.

提交回复
热议问题