Create a CardView with a semicircle on top

后端 未结 3 2255
心在旅途
心在旅途 2021-02-11 08:37

I am very much into designing a login screen.

Something like this:
How Do I actually cut the card from the top so as to fill the drawable on top of it? Any help w

3条回答
  •  名媛妹妹
    2021-02-11 08:55

    You can achieve almost similar by following:

    1. Create a RelativeLayout as a container of CardView and ImageView
    2. Set card_view:cardElevation="0dp" to show ImageView over CardView
    3. On ImageView, set a transparent circle image for profile Icon.

    FYI, If you want elevation for your CardView, set CardView elevation ascard_view:cardElevation="4dp" and set ImageView elevation higher asandroid:elevation="8dp" to show ImageView over CardView.

    Here is the fully working code. Try this:

    
    
    
    
        
    
            
    
                
    
                    
    
                    
    
                    

    OUTPUT:

    ICON: I have used circular profile icon image from this link

    Hope this will help~

提交回复
热议问题