Fragment is transparent and shows Activity below

前端 未结 5 851
旧巷少年郎
旧巷少年郎 2020-12-14 14:27

My Android application launches into BeginActivity which is a subclass of SherlockFragmentActivity and shows it\'s first view using:

@Override
    public voi         


        
5条回答
  •  独厮守ぢ
    2020-12-14 15:21

    Nobody mentioned that if you added a background to your Fragment but you are still getting a transparent background, you need to check that your FrameLayout is the last view in your XML.

    Because z-index in Android is calculated by XML position and lowest view in the hierarchy have the highest z-index.

    For example I fixed this problem recently simply moving the FrameLayout from here:

    
    
        
    
        
        
    
        
        
    
    
    

    to here:

    
    
        
        
    
        
        
    
        
    
    
    

提交回复
热议问题