Android L “delightful” drawable transformations

后端 未结 1 1857
挽巷
挽巷 2021-01-02 23:12

Does Google allow for icon transitions such as these to be created by the developer? Or is it the developers responsibility to create such \"delightful\" transitions? I\'d

1条回答
  •  借酒劲吻你
    2021-01-02 23:28

    You can create an animated icon using AnimatedDrawable and bitmap-based frames. On L, you can use AnimatedStateListDrawable to create stateful animations (such as the check box animation).

    Here is an AnimatedDrawable example (actually this is the implementation for the check box on L preview) using 15ms-long frames that can be started and stopped from code:

    
        
        ...additional frames...
    
    

    And here is an AnimatedStateListDrawable using AnimatedDrawable transitions to implement a check box animation that starts and stops automatically based on View state:

    
        
            
        
        
            
        
        
            
        
        
            
        
        
            
                
                    
                
                ...additional frames...
            
        
        
            
                
                    
                
                ...additional frames...
            
        
    
    

    0 讨论(0)
提交回复
热议问题