Android Button's background as shape with Shadow

前端 未结 6 1316
南旧
南旧 2021-02-02 03:54

I\'ve made a button background from shapes and is looking quite good for my purpose. The only thing needed is to drop a bit of shadow for it. Here is the code:

         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-02 04:11

    If you want to stack more shapes one on top of each other then you could use a layer-list. Bellow is the code for the normal item in your selector(with a strip of gray color):

    
        
            
                
                    
                    
                
            
            
                
                    
                    
                    
                    
                
            
        
    
    

    The problem is that you'll not be able to achieve a true shadow look on your Button with this type of drawable. You could use the code from the other answer or a nine patch image that already has shadow on it.

提交回复
热议问题