Replacing fragments have wrong elevation value

前端 未结 1 1717
温柔的废话
温柔的废话 2021-02-19 02:23

Hello again stack overflowians. I have another fragment question. (I\'m using android.app.Fragment not Support Fragments)

I\'m trying to replace a fragment. But this isn

相关标签:
1条回答
  • 2021-02-19 02:51

    I had the same problem, and spent quite a lot of time trying to fix it. Unfortunately, from my experience, there's no way to make it work for API <=19 on this setup.

    ViewCompat.setElevation() is simply a NoOp for <=19 API, so it can't work. Starting from SDK 21, it sets an elevation and it kinda fixes the problem. Setting Z index works as well.

    The only thing I can advice is to change the transition for API <=19 to not depend on the Z index anyhow. And for 21+ use the transition you wanted. This was the way I did it, and I think it's fine, because the majority of users are on 21+.

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