Elevation not working on a LinearLayout

前端 未结 7 1297
小蘑菇
小蘑菇 2020-12-24 01:25

After searching for a solution, I didn\'t find any to solve my problem.

I have some elevation which produces a shadow on a big part of my app.
But in a particula

7条回答
  •  余生分开走
    2020-12-24 01:49

    As described here https://stackoverflow.com/a/27518160/2481494 there are several requirements so that the shadow is drawn:

    • Space for the shadow in the parents view Group. As bleeding182 mentioned, padding can cause the shadow to be clipped:

      (Do NOT use a padding. A padding on the framelayout will also cut the shadow off)

      However, this can be fixed with android:clipToPadding="false" in the parent.

    • The elevated view needs to have a background to cast a shadow. Without information about your @drawable/button_flat_white I can't tell whether this is a problem in your case.

    To solve your problem you should modify your FrameLayout like this:

    
    

    To check whether your @drawable/button_flat_white causes any problems try to change the background of your LinearLayout to a simple color temporarily:

      
    //some content
    
    

提交回复
热议问题