windowBackground in Android 6 (Marshmallow)

后端 未结 4 1612
故里飘歌
故里飘歌 2021-01-04 03:59

I have defined a base style for my application with the following element:

@color/window_background         


        
4条回答
  •  情话喂你
    2021-01-04 04:48

    I haven't found anything specific for Marshmallow that would cause this. So the suggestions I have are:

    Changing the background color resource to a drawable shape resource.

    From:

    @color/window_background
    

    To:

    @drawable/window_background
    
    
        
    
    

    In case you haven't checked the opacity of all your views:

    Make sure your windowBackground actually is the background of most of your Activity (particularly over scrollable sections where overdraw is the most important to avoid), removing opaque view backgrounds where possible.

    Make your windowBackground work for you instead of using null

    I thought this was interesting, to see the precedence of how background layers are set. I am not sure if you are setting any view backgrounds or how you have set up your app, but this is worth a read.

    Backgrounds consist of several layers, from back to front:

    • the background Drawable of the theme
    • a solid color (set via setColor(int))
    • two Drawables, previous and current (set via setBitmap(Bitmap) or setDrawable(Drawable)), which may be in transition

    BackgroundManager

    I can't find if there is a difference with the themes in Marshmallow, or the order of elements, it seems there has been no fundamental changes and I can find no bug for this.

    I hope this helps, let me know and I can have another look.

    If this doesn't help it may be worth posting some more code relevant to the problem. Cheers.

提交回复
热议问题