Search code examples
androidandroid-layoutandroid-cardview

How to create half overlapped Image to a cardview in android studio


I want to make something like this in the android studio can anyone help me?

enter image description here

How to place that image left to that card view?


Solution

  • Okay, first of all, break down your layout structure and understand the layers.

    A Parent layout with horizontal gravity(ie: LinearLayout) or a relative layout.

    And as child views-

    A Fixed size moon(ie: 100dp).
    
    A Card view with layoutMarginStart="-50dp"(half the moon).
    

    Logically, That should work.

    --If the moon goes under the card use elevation more than the card.