how to set shadow to a View in android?

后端 未结 6 1299
醉话见心
醉话见心 2020-11-27 03:24

I want to know how to add a shadow layer to any general View in android. for eg: suppose i have a layout xml, showing something like this..



        
6条回答
  •  佛祖请我去吃肉
    2020-11-27 04:29

    Assuming u would use a linear layout(i have considered a vertical linear layout)..and have a view just below your linear layout.Now for this view provide a start colour and end colour.. I also wanted to get this thing,its working for me..If you need a even better effect,then just work around the start and end colour.

    activity_main

    
    
    
    
        
        
    
        
        
    
    
    
    

    layout_back_bgn.xml

    
    
    
    
    
    
    
    

    shadow.xml

    
    
        
        
        
    
    

    I tried to post an image which i have it after using the above code,but stackoverflow doesnot allow me coz i dont have reputation..Sorry about that.

提交回复
热议问题