I have tried using https://github.com/captain-miao/OptionRoundCardview this repo but it didn't help the cause as it was giving edged corners.
Asked
Active
Viewed 644 times
4

Gabriele Mariotti
- 320,139
- 94
- 887
- 841
-
The above links answers only rounded corners and non rounded corners but my problem is to get the different radiuses for different corners. – Karnaker Reddy Gaddampally Aug 02 '19 at 05:57
-
@Nilesh Rathod Please help to expalin why its a duplicate question. – Karnaker Reddy Gaddampally Aug 02 '19 at 07:04
-
1Check this ; https://stackoverflow.com/a/8931327/7666442 – AskNilesh Aug 02 '19 at 07:07
-
@NileshRathod the above link can have the shape but need the elevation and shadow exactly as per the outline. – Karnaker Reddy Gaddampally Aug 05 '19 at 01:51
-
You can use the standard MaterialCardView with a simple style. Just check the answer. – Gabriele Mariotti Sep 07 '19 at 15:38
1 Answers
3
You can use the standard MaterialCard
included in the official Material Components library.
Use in your layout:
<com.google.android.material.card.MaterialCardView
style="@style/MyCardView"
...>
In your style use the new shapeAppearanceOverlay
attribute to customize the shape (It requires the version 1.1.0.)
<style name="MyCardView" parent="@style/Widget.MaterialComponents.CardView">
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay_only_on_top</item>
</style>
Something like:
<style name="ShapeAppearanceOverlay.MaterialCardView.Cut" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopRight">4dp</item>
<item name="cornerSizeTopLeft">4dp</item>
<item name="cornerSizeBottomRight">16dp</item>
<item name="cornerSizeBottomLeft">4dp</item>
</style>

Gabriele Mariotti
- 320,139
- 94
- 887
- 841