I have to get this type of card design with semi-circle on both side of cardview along with shadows on both card view and semi-circles.
Thanks in advance.
I have to get this type of card design with semi-circle on both side of cardview along with shadows on both card view and semi-circles.
Thanks in advance.
I found a solution here that create a custom view called TicketView. It provide various option to set the radius of the arc and divider options.
You can use it as custom view.
<com.vipulasri.ticketview.TicketView
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginTop="60dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="@+id/ticketView"
app:orientation="vertical"
app:scallopRadius="10dp"
app:showBorder="false"
app:scallopPositionPercent="50"
app:showDivider="true"
app:dividerType="dash"
app:ticketElevation="14dp"/>
It's not possible using Elevation API. A shadow is generated using view's ViewOutlineProvider with a convex path outlining the view. Your view is not convex, so you cannot make a proper ViewOutlineProvider, so you cannot get a nice, generated shadow that way.
The easiest way is to use a 9-patch with these cutouts drawn on it.