android.support.v4.widget.CircleImageView does not work

前端 未结 8 1474
独厮守ぢ
独厮守ぢ 2021-01-30 04:11

when I try to use : android.support.v4.widget.CircleImageView

        

        
8条回答
  •  故里飘歌
    2021-01-30 04:32

    The CircleImageView is a private class of the support library and cannot be used. But it is easy to create this effect yourself without the CircleImageView. You just need to define a drawable with a transparent circle in the middle similar to this:

    
    
        
    
        
    
    

    After that just combine the image you want to display in the ImageView with the drawable from above in a LayerList like this:

    
        
        
    
    

    If the image you want to display is dynamic then you can create the LayerList programmatically!

提交回复
热议问题