Android: How to achieve the glow effect when long-pressing a list item?

后端 未结 1 367
误落风尘
误落风尘 2020-12-08 17:30

With the default selector, long-pressing a list item causes its background to transition between two colors.

Replacing the selector with the one below removes the ef

1条回答
  •  庸人自扰
    2020-12-08 17:48

    Here is the code from list_selector_background :

    
            
            
            
            
            
            
            
    
    

    Found on the web.

    And it uses this transition for long press clicks :

    
        
        
    
    

    Found on the web too .

    There is no animation for that. And remember to keep you states in the same order, or at least think about it if you swap them, order is important.

    Personnally, I like when things behave in a standard way, so I would just let the standard list selector.

    Regards, Stéphane

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